Checking multiple values for a variable [duplicate]

Use in

if len(original) and original.isalpha():
    word = original.lower()
    first = word[0]
    print first
    if first in ('a','e','i','o','u'):
        print "vowel"
    else:
        print "consonant"

If you were trying to use OR clause you must use like this BUT it’s not the better pythonic way:

if first =='a' or first =='e' or first =='i' or first =='o' or first =='u':

Leave a Comment