I'm struggling to work out what this function in python actually does?
def mystery(n):
a, b = 0, 1
while a < n:
print(a)
a, b = b, a + b
Although basic I don't fully understand what it is achieving? When adding a basic command to run it with the letter N such as-
def mystery(n):
a, b = 0, 1
while a < n:
print(a)
a, b = b, a + b
n = int(input("Input the letter N"))
mystery(n)
It comes up with the strangest outputs, such as-
Input the letter N 20
0
1
1
2
3
5
8
13
Please help me understand this code,
Thanks, Isaac.