Created
July 9, 2021 01:37
-
-
Save Mathsmaniac/86256ed328964902d2439a55749995d7 to your computer and use it in GitHub Desktop.
Calculate winnings for session
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
"""Component 3 of Lucky Unicorn game - winnings system | |
Calculate winnings for session | |
Assumes starting balance of $10 and allows manual input of token for testing purposes | |
Created by Nathan Smith | |
08/07/2021 | |
""" | |
# Assuming starting balance of $10 | |
user_balance = 10 | |
UNICORN_PAYOUT = 5 | |
HORSE_ZEBRA_PAYOUT = 0.5 | |
# allow manual token input for testing purposes | |
token = input("Enter token to test: ").lower() | |
# Adjust user_balance correctly for given token | |
if token == "unicorn": | |
user_balance += 4 | |
print("Congratulations, you won ${:.2f}".format(UNICORN_PAYOUT)) | |
elif token == "horse" or token == "zebra": | |
user_balance -= 0.5 | |
print("Congratulations, you won ${:.2f}".format(HORSE_ZEBRA_PAYOUT)) | |
else: | |
user_balance -= 1 | |
print("Sorry, you did not win anything this round") | |
print("You have ${:.2f} left to play with".format(user_balance)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment