Output Operation: ================= -> Writing or displaying of the data on the screen or console is called as "Output operation". -> In python, for output operation print() function is available. Syntax: print(any value) a = 123;b = 1.0023;c = 1.0023 + 2.004j;d = True;e = 'Python' # Printing of values only print(a) print(b) print(c) print(d) print(e) # if we want to print all these values using single print() ==> we can get the output in the same line print(a,b,c,d,e) # if we want print the output in multiple lines using single print() print(a,'\n',b,'\n',c,'\n',d,'\n',e) # Printing of value along with the text. # Integer = 123 # Float = 1.0023 print("Integer = ",a);print("Float = ",b);print("Complex = ",c);print("Boolean = ",d);print("String = ",e) # Printing the text along with values of different variables using single print() print("Integer = ",a,"Float = ",b,"Complex = ",c,"Boolean = ",d,"String = ",e) print("Integer = %s\nFloat = %s\nCompex = %s\nBoolean = %s\nString = %s"%(a,b,c,d,e)) print("Integer = %s\nFloat = %s\nCompex = %s\nBoolean = %s\nString = %s"%(e,a,b,d,c)) print("Integer = {} Float = {} Complex = {} Boolean = {} String = {}".format(a,b,c,d,e)) print("Integer = {} Float = {} Complex = {} Boolean = {} String = {}".format(b,e,d,a,c)) print("Integer = {p} Float = {q} Complex = {r} Boolean = {s} String = {t}".format(t = e,p = a,r = c,q = b,s = d)) ======================================================================= Operators: ========== -> An operator is a symbol, which denote an operation. Ex: a + b ==> Expression here: a, b ==> Operands + ==> symbols ==> which use to denote an operation addition 9 - 7 9 and 7 ==> operands - ==> symbol ==> which use to denote an operation which called "subtraction". -> Different types of operators: 1) Arithmetic Operators 2) Assignment Operators 3) Relational Operators 4) Logical Operators 5) Conditional Operator 6) Bitwise Operators 7) Special Operators -> all the above operators can categorize into three types: 1) Unary Operators 2) Binary Operators 3) Ternary Operators -> Unary Operators can always define with single operand -> Binary Operators can always define with double operands -> Ternary Operators can always define with more than two operands. 1) Arithmetic Operators ======================= -> all these are binary operators. +, -, *, /, //, %, ** / ==> Normal Division ==> Return a quotient value in float format. // ==> Floor Division ==> Return a quotient value in int format % ==> Modulo Division ==> Return a remainder value a = int(input("Enter an integer:")) b = int(input("Enter an integer:")) c = a + b # sum/addition on a and b d = a - b # subtraction on a and b e = a * b # multiplication on a and b f = a / b # / Quotient in float format g = a // b # Quotient in Int Format h = a % b # Remainder i = a ** b # a ^ b 3 ** 2 ==> 3 ^ 2 ==> 9 Exponent operator, power value print("Sum of",a,"and",b," = ",c) print("The Subtraction of",b,"from",a,"=",d) print("The Product of",a,"and",b,"=",e) print("Quotient in Float = ",f) print("Quotient in Int = ",g) print("Remainder = ",h) print("i = ",i)