mardi 27 décembre 2016

my interpreter don't recognize December as the winter month (if/else)

I'm fairly new to Python. I'm using PyCharm for practice. When I typed "December" in month's input and the interpreter recognize December as the autumn month. Why is this happening? (Look at the bottom if you don't understand what I mean)

Winter = ['December', 'January', 'February']
Spring = ['March', 'April', 'May']
Summer = ['June', 'July', 'August']
Autumn = ['September', 'October', 'November']

month = input('What is the current month? ')

if month == Winter:
    print('%s is in the Winter' % month)

elif month == Spring:
    print('%s is in the Spring' % month)

elif month == Summer:
    print('%s is in the Summer' % month)

else:
    print('%s is in the Autumn' % month)

What is the current month? December
December is in the Autumn

Aucun commentaire:

Enregistrer un commentaire