[Tutor] Understanding error in recursive function

khalil zakaria Zemmoura zemmoura.khalil at gmail.com
Fri Apr 8 19:54:39 EDT 2016


Hi,
 I think your function runs forever because the only thing it done is
calling it self when entering the for loop

when you call your function in the for loop it jump to the definition (def
howMany(aDict)) then initialise count and bond the value 0 to it then enter
a for loop then call the function 'howMany' again and so on!

before the for loop there is nothing happening to the function you defined
or the argument is not modified in the recursive call, so i don't
understand why you used a recursion there!

i think you have to replace the howMany(aDict) in the for loop by aDict it
self and it will be ok.

for value in aDict: ...

Regards


More information about the Tutor mailing list