I wanna ask if we can put 2 or more conditions in single 'if' For example:
if a == 1 b == 2:
print 'can we do this? If yes, how? '
I wanna ask if we can put 2 or more conditions in single 'if' For example:
if a == 1 b == 2:
print 'can we do this? If yes, how? '
If you want to check that both are true, use and
:
if (a == 1) and (b == 2):
"If a
equals 1 and b
equals 2 ...".
Look up logical operators for other similar operations.
For both conditions to be true
if condition1 and condition2:
For one of the conditions to be true
if condition1 or condition2: