Why does the process do it in the form of a loop if there is no while or for? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why does the process do it in the form of a loop if there is no while or for?

def fib(x): if x == 0 or x == 1: return 1 else: return fib(x-1) + fib(x-2) print(fib(4))

16th Aug 2022, 6:22 PM
Josué Varela
Josué Varela - avatar
2 Answers
+ 3
The keyword is "recursion". Have a look at lesson 68 of the Python Core course again.
16th Aug 2022, 6:48 PM
Lisa
Lisa - avatar
+ 1
You better search for recursive tutorial on the web, it is not a easy topic and Sololearn could not explain this concept very deeply.
16th Aug 2022, 6:52 PM
abpatrick catkilltsoi
abpatrick catkilltsoi - avatar