Skip to content

Instantly share code, notes, and snippets.

@morisasy
Last active December 30, 2017 10:42
Show Gist options
  • Save morisasy/1e134fc8b2a48bb8db5d61c1b39b7267 to your computer and use it in GitHub Desktop.
Save morisasy/1e134fc8b2a48bb8db5d61c1b39b7267 to your computer and use it in GitHub Desktop.
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