Nov-24-2018, 09:10 PM
Here's how I would have done it:
f=[1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] while True: user_input = input() if user_input == 'END': break user_input = int(user_input) while len(f) < user_input: f.append(sum(f[-2:]) print (f[user_input - 1])That only calculates what you need when you need it.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures