python multiple conditions in if code example

Example 1: python if statement multiple lines

# ex. 1
if (cond1 == 'val1' and cond2 == 'val2' and 
       cond3 == 'val3' and cond4 == 'val4'):
    do_something
    
# Also, don't forget the whitespace is more flexible than you might think:
# ex. 2
if (   
       cond1 == 'val1' and cond2 == 'val2' and 
       cond3 == 'val3' and cond4 == 'val4'
   ):
    do_something
if    (cond1 == 'val1' and cond2 == 'val2' and 
       cond3 == 'val3' and cond4 == 'val4'):
    do_something

Example 2: if else statement with multiple conditions python

if( (5 ** 2 >= 25) and (4 * 2 < 8) or (35 / 7 > 4) ):
	print("Booleans make If more powerful!")