def fib(n):
if n==0:
return 0
elif n==1:
return 1
else:
= 1
fnm1 = 0
fnm2 for i in range(2,n+1):
= fnm1 + fnm2
fn = fnm1
fnm2 = fn
fnm1 return fn
= int(input("Which Fibonacci number do you want? "))
n print(f"Fibonacci number {n} is equal to {fib(n)}")
nth Fibonacci number
sample solution