python if multiple conditions lines 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: python double condition if

if conditionA and conditionB:
	print('and')
    
if conditionA or conditionB:
  	print('or')