Python conditionals

From wikinotes
Revision as of 17:37, 6 May 2018 by Will (talk | contribs) (→‎if statement)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

if statement

if var == 'no' :
   print "something"
elif var == 'yes' :
   print "something else"
else:
   print "something else entirely"


You may find the all keyword useful:

if all([
    a == 1,
    b == 2,
    c == 3,
]):
    print('success')