1# ex. 1
2if (cond1 == 'val1' and cond2 == 'val2' and
3 cond3 == 'val3' and cond4 == 'val4'):
4 do_something
5
6# Also, don't forget the whitespace is more flexible than you might think:
7# ex. 2
8if (
9 cond1 == 'val1' and cond2 == 'val2' and
10 cond3 == 'val3' and cond4 == 'val4'
11 ):
12 do_something
13if (cond1 == 'val1' and cond2 == 'val2' and
14 cond3 == 'val3' and cond4 == 'val4'):
15 do_something
1>>> i=100
2>>> a = 1 if i<100 else 2 if i>100 else 0
3>>> a
40
5>>> i=101
6>>> a = 1 if i<100 else 2 if i>100 else 0
7>>> a
82
9>>> i=99
10>>> a = 1 if i<100 else 2 if i>100 else 0
11>>> a
121
13