Page 435 - AI Ver 3.0 class 10_Flipbook
P. 435
Logical operators used in Python are given below:
Name Symbol Purpose Example Output
AND and Returns True if both the Num1=14
operands are true. Num2=10
Num1<Num2 and Num1>20 False
OR or Returns True if either the Num1=14
operands is true. Num2=10
Num1>Num2 or Num1<Num2 True
NOT not Returns True if the operand is not(5>10 or 2<5) False
False and vice versa. It reverses not(5<10) True
the result. not(False) True
Brainy Fact
In case of OR operator, the second condition is checked only if the first is False otherwise it ignores the
second operand.
Assignment Operator
Assignment operator is used to assign a value to a variable or a constant. The '=' sign is used as an assignment
operator in Python.
[1]: RollNo = 7
Name = "Aparna"
Percentage = 97.6
Augmented Assignment Operators
Augmented assignment operators are those operators which take the value of the operand on the right side,
perform an operation and assign a new value to the operand on the left side. For example, if Sum=0, then
Sum+=10 is the same as Sum=Sum+10.
These operators with example are shown below:
Symbol Purpose Example Output
+= Adds first and then assigns a new N1=10
value. N2=15
N1+=N2
N2+=5
print(N1,N2) 25 20
Advance Python (Practical) 433

