- 2

What's with the if statement

how to use it to give a true or false answer

8th Jan 2020, 5:56 PM
Fun Pope
Fun Pope - avatar
2 ответов
+ 1
True or False are booleans. You can get booleans by expressions. You could say that all the apples in the world are green, that is an expression, which can either be true or false. You could say that: if all apples in the world were green, all apples I eat would be green. In maths that is an expression too, but in Python it does not return a boolean, instead you can run a piece of code, write it to perform the wanted actions if the condition gets a true boolean. In Python getting boolean is got by checking whether an expression is true. Python can easily compare numbers. 5 > 9 is an expression which in english means "5 is greater than 9" it can be either true or false. Heres is an example where the expression is used: if 5 > 9: print("5 is greater than 9.") It printz "5 is greater than 9." if 5 > 9 was true, because it's not, the text wont be printed.
8th Jan 2020, 8:53 PM
Seb TheS
Seb TheS - avatar