Created
December 3, 2019 15:05
-
-
Save jacob414/503110ac59f19bf1306911f21fab52f0 to your computer and use it in GitHub Desktop.
Simplest possible(?), but still readable program that shows how a small percentage increase always leads to doubling.
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
"""An extremely simple program that shows how a comparately small | |
percentage of growth turns into a consecutive doubling of the starting | |
value. | |
The strength of the relation between energy and | |
""" | |
import time | |
year = 1 | |
money = 1 | |
original_money = 1 | |
growth = 7 | |
while growth > 1: | |
while True: | |
print( | |
"After year {} of {} % growth we have a nominal sum of {} 'currency'." | |
.format(year, growth, money)) | |
money = round(money + (growth / 100), 2) | |
year = year + 1 | |
time.sleep(0.5) # ..so that it doesn't print faster than you can see. | |
if money >= original_money * 2: | |
print() | |
print() | |
print( | |
"At {} % growth the nominal size of the economy doubled after " | |
"{} year(s)".format(growth, year)) | |
print( | |
"-------------------------------------------------------------------------------" | |
) | |
print() | |
print() | |
money = 1 | |
growth = growth - 1 | |
year = 1 | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment