0
How to use boolean in Python
3 Respostas
0
booleans are:
True / False
0
Booleans are used in situations where a comparison has a definite "yes" or "no" answer. Is 4 the square of 2? Yes.
You may simply implement like so:
if (4 > 2 == True):
print("4>2")
#comparisons return, always
0
some example:
if True:
print('Something')
else:
print('Nothing')
Output is: Something
another example:
a = False
b = 3
c = 5
if a == True:
print(b + c)
else:
print(b × c)
output is : 15 (due to false value of the a variable)