Given a list containing string elements, the task is to write a Python program to print string with maximum vowels.
Input : test_list = [“gfg”, “best”, “for”, “geeks”]
Output : geeks
Explanation : geeks has 2 e’s which is a maximum number of vowels compared to other strings.
Input : test_list = [“gfg”, “best”]
Output : best
Explanation : best has 1 e which is a maximum number of vowels compared to other strings.
Approach : Using loop
In this, we iterate for all the strings and keep a counter to check number of vowel in each string. Then, return the string with maximum vowels at end of the loop.
The original list is : [‘gfg’, ‘best’, ‘for’, ‘geeks’]
Maximum vowels word : geeks
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.