Please help me to use python write this question thanks Give

Please help me to use python write this question, thanks.

Given a string as input, count the vowels and return the result. The given string may be upper or lower case, and \'Y\' is not considered a vowel.

Solution

Python code:


string = input(\"Sentence: \") Sentence: this is a sentence >>> counts = {i:0 for i in \'aeiouAEIOU\'} >>> for char in string: ... if char in counts: ... counts[char] += 1 ... >>> for k,v in counts.items(): ... print(k, v) ...
Output:
a 1

e 3

u 0

U 0

O 0

i 2

E 0

o 0

A 0

I 0

Please help me to use python write this question, thanks. Given a string as input, count the vowels and return the result. The given string may be upper or lowe

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site