• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Recursive function that takes a string as argument and determines if the string has more vowels than consonants

Resolved: Recursive function that takes a string as argument and determines if the string has more vowels than consonants

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

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!

python recursion
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Input Focus between two React Components

02/04/2023

Resolved: linq2db throws exception when filtering by nested collection

02/04/2023

Resolved: Table data is coming as empty in React

02/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.