Programming Examples
Implement python script to accept line of text and find the number of characters, number of vowels and number of blank spaces in it.
Implement python script to accept line of text and find the number of characters, number of vowels and number of blank spaces in it.
text = input("Enter a line of text: ")
char_count = len(text)
vowel_count = 0
space_count = 0
for ch in text:
if ch.lower() in 'aeiou':
vowel_count += 1
if ch == ' ':
space_count += 1
print("Number of characters:", char_count)
print("Number of vowels:", vowel_count)
print("Number of blank spaces:", space_count)
Output/ Explanation: