I want to count how many vowel occurences in a certain word using recursive way. May i know if these is a valid recursive function.
def count_v(word, i, j, v_count):
if i<=j:
v_list = list(v_count.keys())
v_count[v_list[i]]+=word.count(v_list[i])
return count_v(word, i+1, j, v_count)
return v_count
w = input('Enter a word: ')
print(count_v(w, 0, 4, {v:0 for v in 'aeiou'}))
I tried running it and it shows correct ouput in dict format.