Python | Program to accept the strings which contains all vowels

Given a string, the task is to check and accept the given string if contains all vowels i.e. ‘a’, ‘e’, ‘i’.’o’, ‘u’ or ‘A’, ‘E’, ‘I’, ‘O’, ‘U’ .

Examples :

Input : geeksforgeeks
Output : Not Accepted

Input : ABeeIghiObhkUul
Output : Accepted

Approach : Firstly, create set of vowels using set() function. Check for each character of the string is vowel or not, if vowel then add into the set s. After coming out of the loop, check length of the set s, if length of set s is equal to the length of the vowels set then string is accepted otherwise not.

Below is the implementation :





# Python program to accept the strings
# which contains all the vowels
# Function for check if string
# is accepted or not
def check(string) :
    # set() function convert "aeiou"
    # string into set of characters
    # i.e.vowels = {'a', 'e', 'i', 'o', 'u'}
    vowels = set("aeiou")
    # set() function convert empty 
    # dictionary into empty set
    s = set({})
    # looping through each
    # character of the string
    for char in string :
    # Check for the character is present inside
    # the vowels set or not. If present, then
    # add into the set s by using add method
        if char in vowels :
    # check the length of set s equal to length 
    # of vowels set or not. If equal, string is  
    # accepted otherwise not
    if len(s) == len(vowels) :
    else :
        print("Not Accepted")
# Driver code
if __name__ == "__main__" :
    string = "SEEquoiaL"
    # lower method of string convert
    # every character into small letter
    string = string.lower()
    # calling function




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.