FOLLOW ME ON :

Go to My Social Media Pages

Select an option:

PYTHON QUEUE VOWEL

Python Vowel Identifier

Python Vowel Identifier

# Function to check if a letter is a vowel def is_vowel(letter): vowels = ['a', 'e', 'i', 'o', 'u'] queue = [] # Add vowels to the queue for vowel in vowels: queue.append(vowel) # Check if the letter is a vowel if letter.lower() in queue: return True else: return False # Prompt the user to enter a letter letter = input("Enter a letter: ") # Check if the letter is a vowel if is_vowel(letter): print(letter, "is a vowel.") else: print(letter, "is not a vowel.")

The above Python code prompts the user to enter a letter and identifies whether it is a vowel or not using a queue. It defines a function `is_vowel` that checks if a letter is present in the queue of vowels. The letter entered by the user is then checked using this function, and the result is displayed accordingly.

Comments

game