I am trying to write a simple piece of code that checks how many times each of the letters: a,e,i,o,u exists in a string but i am getting the error: string index out of range. what can I do to fix that? the code is:
def targ6(str6):
x = ['a','e','i','o','u']
s = ""
for tav in str6:
for y in range(len(x)):
if x[y] == tav:
s[y] += 1
for y in range(len(x)):
return ('the letter'+x[tav]+'appears'+s[tav]+'times')
#main
string6=input("enter a string")
print(targ6(string6))