Account
Categories

Less Than Operator (<)


Definition:

It is a relational operator used in a programming language.

If you want to check whether the value of the left operand is less than the right operand, you use the less than operator (<).

If it finds the condition true, then it returns True; otherwise, it returns False.

Syntax:

a < b

Example:

rm_temperature = 19

if rm_temperature < 21:
    print("Weather is very cold")
else:
    print("Weather is Normal")

Output:

Exercise

Create a variable age with value 15 and check whether it is less than 18 using the less than operator.