boshinitp n = int(input(“enter a num: “)) n1 = 0 n2 = 1 temp= 0 l = [n1,n2] for i in range(2, n): temp = n1+n2 l.append(temp) n1 = n2 n2 = temp print(l[n-1]) Log in to Reply
manubhai28102005 num = int(input(“Enter Num: “)) n1 = 0 n2 = 1 arr = [] arr.append(n1) arr.append(n2) for i in range(2,num): n3 = n1 + n2 n1 = n2 n2 = n3 arr.append(n3) print(arr) Log in to Reply
ncinthala n=int(input(‘enter the nth number ‘)); temp=0; temp1=1; sum=0; arr=[]; arr.append(temp); arr.append(temp1); for i in range(1,n-1): sum=temp+temp1; temp=temp1; temp1=sum; arr.append(sum); print(arr[n-1]); Log in to Reply
sufiyashaik781 def fib(N): if N==0: return [] elif N==1: return [0] elif N==2: return [0,1] else: arr=[0,1] for i in range(2,N): n=arr[i-1]+arr[i-2] arr.append(n) return n N=int(input()) print(fib(N)) Log in to Reply
n = int(input(“enter a num: “))
n1 = 0
n2 = 1
temp= 0
l = [n1,n2]
for i in range(2, n):
temp = n1+n2
l.append(temp)
n1 = n2
n2 = temp
print(l[n-1])
num = int(input(“Enter Num: “))
n1 = 0
n2 = 1
arr = []
arr.append(n1)
arr.append(n2)
for i in range(2,num):
n3 = n1 + n2
n1 = n2
n2 = n3
arr.append(n3)
print(arr)
n=int(input(‘enter the nth number ‘));
temp=0;
temp1=1;
sum=0;
arr=[];
arr.append(temp);
arr.append(temp1);
for i in range(1,n-1):
sum=temp+temp1;
temp=temp1;
temp1=sum;
arr.append(sum);
print(arr[n-1]);
def fib(N):
if N==0:
return []
elif N==1:
return [0]
elif N==2:
return [0,1]
else:
arr=[0,1]
for i in range(2,N):
n=arr[i-1]+arr[i-2]
arr.append(n)
return n
N=int(input())
print(fib(N))
import math
n=5
print(math.factorial(n))