Python Programming - Console Input/Output - Discussion

Discussion Forum : Console Input/Output - General Questions (Q.No. 61)
61.
How can you prompt the user to enter a sentence and count the number of vowels?
count_vowels(input("Enter a sentence: "))
vowel_count(get_sentence())
sentence = input("Enter a sentence: "); print(sum(1 for char in sentence if char.lower() in 'aeiou'))
get_vowel_count("Enter a sentence: ")
Answer: Option
Explanation:
To prompt the user to enter a sentence and count the number of vowels, use sentence = input("Enter a sentence: "); print(sum(1 for char in sentence if char.lower() in 'aeiou')).
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.