def life(years):
while years > 0:
return life(years-1)
years = 110
life(years)
Nothing fancy, just a personal log with a built in search function so I can recall what is easily forgotten.
Saturday, July 30, 2022
Life in Python Recursive
Sunday, July 10, 2022
Python Fibonacci
fibs = []
for i in range(20):
fibs.append(i) if (i==0) or (i==1) else fibs.append(fibs[i-1] + fibs[i-2])
i += 1
print(fibs)
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181]
Subscribe to:
Posts (Atom)