Last active
December 22, 2015 07:09
-
-
Save lucpet/6436039 to your computer and use it in GitHub Desktop.
Example if elif else statement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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