Question:
Why doesn’t this work?:
this will return
False
.
but if I do this it works fine:
Need some conceptual clarity.
Answer:
your first recursion returns boolean
so when you are calling this line
what actually happens is
or
and that means that total_vowels value is at most vowels_count+1 (in case recursiveVowels(str[1:]) returned True), which means its at most 2 so your function will return false for any string longer than 4
hope I could help,
feel free to ask for any clarification in the comments ๐
If you have better answer, please add a comment about this, thank you!