Why doesn’t this work?:
this will return
but if I do this it works fine:
Need some conceptual clarity.
your first recursion returns boolean
so when you are calling this line
what actually happens is
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!