Why none is printed | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why none is printed

num = int(input()) def fibonacci(n): #complete the recursive function if n<=1 : return n else : a = 0 b = 1 print(a) print(b) for i in range (2,n): c = a+b print(c) a = b b = c print (fibonacci(num)) #output for 5 as num : # 0 # 1 # 1 # 2 # 3 # none (why none is printed ?)

25th Dec 2022, 4:16 PM
Ben Hamida Mohamed Amine
Ben Hamida Mohamed Amine - avatar
2 Answers
+ 4
Ben Hamida Mohamed Amine Or dont print function just call it
25th Dec 2022, 4:18 PM
A͢J
A͢J - avatar
+ 3
You should return something inside else part also
25th Dec 2022, 4:17 PM
A͢J
A͢J - avatar