Page 194 - AI Ver 1.0 Class 10
P. 194
Name Symbol Purpose Example Output
Remainder % Returns the remainder of a 17%3 2
division. 3%5 3
Addition + Adds two values 10+4 14
Note: With strings it 2.5+4 6.5
concatenates two values. "Good"+"Morning" "Good Morning"
Subtraction – Subtracts second values from 14-9 5
the first value. 5.5-2 3.5
Comparison or Relational Operators
Comparison or relational operators compare the values given on both sides of the operators and based on the
evaluation returns the Boolean value True or False. Relational operators used in Python are given below:
Name Symbol Purpose Example Output
Equal to == Returns True if both the a=16
values are the same. b=12
a==b False
Not equal to != Returns True if both the a="Hello"
values are different. b="hello"
a!=b True
Greater than > Returns True if first value Num1=34
is greater than the second Num2=23
value.
Num1>Num2 True
Less than < Returns True if first value is Num1=15
less than the second value. Num2=10
Num1<Num2 False
"Hi">"HI" True
"67">"621" True
(text compared using
ASCII code)
Greater than or equal >= Returns True if first value is Num1=5
to greater than or equals to Num2=10
second value.
Num1>=Num2 False
Less than or equal to <= Returns True if first value is Num1=5
less than or equals to second Num2=10
value.
Num1<=Num2 True
192 Touchpad Artificial Intelligence-X

