Question 1:
Take a single line text message from user. Separate the vowels from the
text. Find the repeating occurrences of vowels from the text message.
Display count of which vowel has repeated how many times.
Display a new Text message by removing the vowel characters as output
Display the output in exact format shown below in example, after
displaying count of characters on next lines display the new text message
on next line
"Hii wlcm" is the new text message
If text message entered by user does not contain any vowels then display
O as output
If text message entered by user contain any numeric value then display O
as output
If User enters blank or empty text message display "INVALID INPUT as
output. Message INVALID INPUT" is case sensitive Display it in exact
format given
Answers
Answered by
3
Answer:
userInput = input("enter text in single line\n")
vowels = ['a' ,'e', 'i', 'o', 'u', 'A', 'E','I','O','U']
vowelCount = {}
textOutput = ''
for i in userInput:
if i in vowels:
if i in vowelCount:
vowelCount[i] += 1
else:
vowelCount[i] = 1
else:
textOutput += i;
for _ in vowelCount:
print(_+'={}'.format(vowelCount[_]))
if len(userInput)==0:
print("INVALID INPUT")
else:
if vowelCount == {} or userInput.isnumeric():
print("O")
else:
print(textOutput)
Explanation:
follow github.com/sajidrsk
Similar questions
English,
3 months ago
Math,
3 months ago
Environmental Sciences,
6 months ago
Science,
6 months ago
Biology,
11 months ago