Join 36000+ teachers and students using TTIO.
Decisions - Control Flow - If Else statements
As you start programming, you'll find very quickly that you'll require the use of if-else statements or conditional logic. Well, fortunately, Python supports the usual logical conditions from mathematics:
Equals: a == b
Not Equals: a != b
Less than: a < b
Less than or equal to: a <= b
Greater than: a > b
Greater than or equal to: a >= b
These conditions can be used in several ways, most commonly in "if statements" and loops.
An "if statement" is written by using the if keyword.
a = 7
b = 100
if b > a:
print("b is greater than a")