The following exercises cover Operators in Python.
Exercise 1
Specify the correct Arithmetic operator to add the two numbers.
a = 5 b = 10 sum = a b print(sum)
Exercise 2
Specify the correct Comparison operator to check if value in a is greater than that of b.
a = 5 b = 10 if a b: print('a is greater than b.') else: print('a is not greater than b.')
Exercise 3
Specify the correct Logical operator to check if value in a is greater than 4 and also even.
a = 10 if a > 4 a % 2 == 0: print('a is greater than 4, and even.')