+ 1
Step by step explanation please?
I didn't get this one (else part). Help me out please :-( https://code.sololearn.com/cxdjfMP8QXrF/?ref=app
2 Answers
+ 2
https://www.sololearn.com/Discuss/2125616/?ref=app
0
def f(n): #define a function named f with one variable n#
if n==0: #if n is 0 return 0#
return 0
if n==1: #if n is 1 return 1#
return 1
else:
return(f(n-1)+f(n-2)) #else apply this function#
print(f(5)) #substitute n with 5 and print the solution#