Created
March 1, 2019 02:52
-
-
Save brainysmurf/4e589a33b871ad71f19e5eaaf8bd2797 to your computer and use it in GitHub Desktop.
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
| import time | |
| prompt = """ | |
| You have a choice: | |
| a) $1 million, right now | |
| b) $0.02 right now, then doubled every month | |
| """ | |
| while True: | |
| choice = input(prompt) | |
| normalized_choice = choice.lower().strip() | |
| if normalized_choice in ['a', 'b']: | |
| break | |
| else: | |
| print("Dude. A or B!!") | |
| print() | |
| print() | |
| if normalized_choice == 'a': | |
| print("Here is your money: ${}".format('1 million')) | |
| print("Here is how much you would have gotten, had you chosen a") | |
| print() | |
| bank = 0.02 | |
| month = 1 | |
| while True: | |
| print("After {} month(s)".format(month), end=" ") | |
| print("there is ${:0,.2f} in the bank".format(bank)) | |
| bank *= 2 | |
| month += 1 | |
| time.sleep(0.5) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment