FORMAT SPECIFIER ==> SYMBOL MACHINES CAN READ THE TYPE OF THE DATA. ==> % INTEGER ==> %d FLOAT ==> %f CHARACTER ==> %c % ==> make print the data in the specified format %s ==> %(a,b,c) true, false ==> java true ==> never be 1 false ==> never be 0 True, False ==> Python if, else True ==> 1 (int) False OPERATORS =========== statement ======== ==> a line of python code ==> with or without ending semi-colon program: ======= ==> group of statements expression ======== ==> the joining of operand and operator Ex: 123 * 2 a = int(input()) block ==== ==> group of one or more than one statement ==> block In java: block of code{ int a = 100; float f = 21.23f; } In Python: block of code ==> indentation print("Hello") a = 97 b = 79 if a > b: big = a print("Biggest number = ",big) else: big = b print("Biggest number = ",big) operand ====== a = int(input("Enter an Integer:")) 97 b = int(input("Enter an Integer:")) 79 print("The Sum is = ", a + b) a + b ==> 97 + 79 ==> 176 ==> a data on which we can define an operation called as "operand" ==> an operand is a data/variable operator ====== ==> a symbol which is used to specify the type of operation. sum ==> + subtraction ==> - multiplication ==> * ex: a+b ==> a and b ==> operands + ==> operator types of operators ============== ==> categorised into three types: 1) Unary operators ==> always be defined with single operand ex: logical not operator, bitwise complement, unary minus etc. ==> not a ==> logical not ==> ~a ==> bitwise complement ==> -a ==> unary minus 2) Binary Operators ==> always be used with two operands ex: 97 + 79, 9 / 2, 97 > 79 etc. 3) Ternary Operators ==> used with three operands also called as "conditional operator" Syntax: result = part-1 if condition else part-2 ex: a = 100 b = 200 c = 300 big = a if a > b and a > c b elif b > a and b > c else c ==> big = 100 > 200 else 200 ==> big = 200 ==> based on the number of operands Operator classification ================= ==> based on the type of the operation: the operators are classified into: 1) Arithmetic operators 2) Assignment operator 3) Compound Operator 4) Relational Operators 5) Logical Operators 6) Bitwise Operators 7) Conditional Operators 8) Special Operators 1) Arithmetic operators ================= Unary Minus ==> - ==> to change the sign of the data. plus ==> + ==> addition minus ==> - ==> subtraction asterisk ==> * ==> multiplication three division operators: normal division ==> backslash ==> / ==> return quotient in float floor division ==> double backslash ==> // ==> return quotient int modulo division ==> percentage ==> % ==> return a remainder Power Operator ==> double asterisk ==> ** Ex: 2^3 ==> 2 ** 3 ==> 8 print(10 + 20) print(10 - 20) print(10 * 20) print(10/20) print(10//20) print(10 % 20) print(10 ** 20) a = -10 print(a) print(-a) ============================== 2) Assignment operator ================== ==> = ==> used to assign a value to the expression/variable. Ex: a+b = 10 a = 100 Syntax: expression/variable = value 3) Compound Operator ================== ==> when we can join other operators with assignment operator ==> compound operator Ex: +=, -=, *=, /=,//=,%=, **= &=,|= etc. a = 1 a = a + 10 ==> 11 a += 10 ==> 1 + 10 ==> 11 a = 10 print(a) # a = a + 10 a += 10 print(a) # a = a - 5 a -= 5 print(a) # a = a * 2 a *= 2 print(a) # a = a & 2 a &= 2 print(a)