74.1k views
5 votes
this function checks if a character is a vowel. if it is, it returns true. otherwise, it returns false. where should return false; be written in the code?

User Lecko
by
6.1k points

1 Answer

2 votes

In Python, it can be easily written as follows:

def check_vowel(char):

return True if (char=='a' or char=='e' or char=='i' or char=='o' or char=='u') else False

print(check_vowel(input("Please enter the character: ")[0].lower()))

this function checks if a character is a vowel. if it is, it returns true. otherwise-example-1
User Snackdex
by
5.6k points