• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
June 10, 2022 |7.1K Views
Count number of vowels using sets in given string
  Share   Like
Description
Discussion

Input : GeeksforGeeks
Output : No. of vowels : 5

Input : Hello World
Output : No. of vowels :  3

1. Create a set of vowels using set() and initialize a count variable to 0.
2. Traverse through the alphabets in the string and check if the letter in the string is present in set vowel.
3. If it is present, the vowel count is incremented.

Python Programming Tutorial | Count number of vowels using sets in given string: https://www.geeksforgeeks.org/python-program-count-number-vowels-using-sets-given-string/

Read More