Voliminal
Voliminal

Reputation: 13

Issue with code continuing?

I wrote this, and for some reason after I get to the point of asking what month it is, it doesn't go any further. I'll type in a month and the code will just end.

    year = input("What year is it?")
    if year == "1996":
input ("What month is it?")
    month = "January"
    elif month == ["January","Febuary", "March"]:
input == ("How much snow fell that month?")

Any help would be great

Upvotes: 1

Views: 38

Answers (2)

tripleee
tripleee

Reputation: 189487

Assuming this is Python3, the return value from input can never be a list containing three different month names. You probably mean

elif month in ['January', 'February', 'March']:
    snow= input(...)

Notice also how input == ('...') is not what you want, and whimsically pointless.

Finally, like @TravisJacobs notes, you need to capture the month name input.

month = input('What month is it?')

It's not clear if month = 'January' should only happen if year is not 1996; then, you need to put it in an else: clause.

Upvotes: 0

Travis
Travis

Reputation: 2767

It looks like input("What month is it?") needs to be assigned to a variable.

Ex: month = input("What month is it?")

Upvotes: 1

Related Questions