Hey there, I am working to create a program and the answers I found is not complete, no correct out put. When I run it doesn't give me the right out put even if I edited. Here is one question for example: def countVowels(): user_text = input('Enter a string:') vowelsCount = 0 # variable to hold total number of vowels listOfVowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'] # list of vowels to compare for ch in user_text: # iterate and compare with vowel if ch not in listOfVowels: # check if ch is in the list or not vowelsCount = vowelsCount + 1 # ch found in listOfVowels, so increment count print('The number of vowels is', vowelsCount) # print output countVowels() #My question# no correct out put for the number of Vowels. hint: may be the vowelsCount = 0 part has to be fixed
Hey there, I am working to create a program and the answers I found is not complete, no correct out put. When I run it doesn't give me the right out put even if I edited. Here is one question for example:
def countVowels():
user_text = input('Enter a string:')
vowelsCount = 0 # variable to hold total number of vowels
listOfVowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'] # list of vowels to compare
for ch in user_text: # iterate and compare with vowel
if ch not in listOfVowels: # check if ch is in the list or not
vowelsCount = vowelsCount + 1 # ch found in listOfVowels, so increment count
print('The number of vowels is', vowelsCount) # print output
countVowels()
#My question# no correct out put for the number of Vowels.
hint: may be the vowelsCount = 0 part has to be fixed.
let me get your important hints. Thanks in advance!
Please find the answer below :
Step by step
Solved in 2 steps with 4 images