+ 1

recursion

How does line 5 in my code work?https://code.sololearn.com/c6sCEznJy3RB/#py. I do not understand that line of code?

8th Aug 2019, 6:34 PM
Khai123
Khai123 - avatar
3 Respuestas
+ 5
it calls the function with new parameters until the condition evaluates to false and it won't call itself anymore
8th Aug 2019, 6:52 PM
notqueued
notqueued - avatar
+ 2
This code loops, by calling itself, until i==len(a), which is six. So i=0, then adds 1 until i=6. Recursion is calling the define function within itself, it's a loop https://www.sololearn.com/post/131090/?ref=app
8th Aug 2019, 6:53 PM
Steven M
Steven M - avatar
+ 1
i got it after writing the code on paper thanks
8th Aug 2019, 7:03 PM
Khai123
Khai123 - avatar