Last active
December 30, 2017 10:42
-
-
Save morisasy/1e134fc8b2a48bb8db5d61c1b39b7267 to your computer and use it in GitHub Desktop.
This file contains 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
def which_prize(points): | |
""" | |
Returns the prize-winning message, given a number of points | |
""" | |
points = int(points) | |
prize = None | |
if points <= 50: | |
prize = "a wooden rabbit" | |
elif 151 <= points <= 180: | |
prize = "a wafer-thin mint" | |
elif points >= 181: | |
prize = "a penguin" | |
if prize: | |
return "Congratulations! You have won {prize}!".format(prize) | |
else: | |
return "Oh dear, no prize this time." | |
selected_point=input("Please choose a point between 0 to 200 to win a prize: ") | |
print(which_prize(selected_point)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment