What is difference between iteration and recursion? And what is iterator? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is difference between iteration and recursion? And what is iterator?

I am learning python.

23rd Aug 2020, 8:03 PM
Harsh Kathiriya
2 Answers
+ 3
Hello! I am not an expert in python, but I can explain the concepts. Recursion is the concept of a function calling itself until a certain condition is met, that stops the functions. Search it on youtube for amazing explanations to understand more. An iterator is an loop that iterates (loops) trough a collection of data, like a list(array). An iterator helps reading and modifying data. For example, you would need an iterator to print each item of an list without knowing the length of it. Iteration and recursion don't share many similarities and for more explinations regarding the concepts applied in python, search it on youtube. :)
23rd Aug 2020, 8:11 PM
🈂️Toma
🈂️Toma - avatar
0
Recursion is circular. Iteration is linear.
25th Aug 2020, 7:58 PM
Terminal_Phantom
Terminal_Phantom - avatar