HowtoBecomeaProgrammer

About UsContact Us

Conditions are just like inequalities in math, <, <=, ==, >, >=, !=. If the condition makes since, then it is true, and value of inequality would be True, however if the inequality is false, than the value of the inequality would be False.

For example, print(43 < 21) would output False, as the 43 is not less than 21. Some of the unique conditions are !=, where if the two values for != are not equal, then the value is True. The condition 'or' is True if one or more of the conditions are True, for example print(True or 43 < 21) would output True, even though 43 is not less than 21. For and, both conditions have to be True for it to be True, and not, which reverses the value of a condition, for example print(not True) would output False.

A challenge for you is to guess the output of the following code without running it yourself, but you can run it afterwards to see if you got the correct answer: print(not True and False or 43 < 21 and True or 21 >= 21)

Once you have completed the challenge move on to the next lesson.