Here's the Python code for a function that checks if a character is a vowel:

def check_vowel(character):
    vowels = ['a', 'e', 'i', 'o', 'u']
    if character.lower() in vowels:
        print(f"The character '{character}' is a vowel.")
    else:
        print(f"The character '{character}' is not a vowel.")

# Example usage:
user_input = input("Enter a character: ")
check_vowel(user_input)

This code defines a function called check_vowel(). It takes a single character as input and checks if the lowercase version of the character is present in the list of vowels. If it is, the function prints that the character is a vowel. Otherwise, it prints that the character is not a vowel.

You can test the function by running the code and providing a character when prompted. The function will then output whether the entered character is a vowel or not.

Python Function to Check if a Character is a Vowel

原文地址: https://www.cveoy.top/t/topic/pdfv 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录