Skip to content

Instantly share code, notes, and snippets.

@lucpet
Last active December 22, 2015 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucpet/6436039 to your computer and use it in GitHub Desktop.
Save lucpet/6436039 to your computer and use it in GitHub Desktop.
Example if elif else statement
if 2 + 2 >= 5: # if shit happens do shit
print('woo hoo')
elif 2 + 2 >= 4: # if that last shit didn't happen then do this
print('yay')
else:
2 + 2 <= 3 # if none of that last shit happened then do this
print('WTF')
#----------------------------------------------------------------
def stuff_happens(num):
if 2 + num >= 5: # if stuff happens do shit
print('it\'s too big mate')
elif 2 + num >= 4: # if that last stuff didn't happen then do this
print('yay it\'s just right')
elif 2 + num <= 3:
print('ok now you\'re just being silly')
return num
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment