0

I want to create a python program where you can enter a month and it will tell you the following month.

Ive managed to come up with this so far- there are no syntax errors just when i run my code if i type in 'march' for example it will give me a long list of the print statements.

print('Hello and welcome to the program, enter a month of the year and the program will tell you the following month')
month = input('Please enter a month:')
if month == 'January' or 'january':
    print ('The next month will be February')

if month == 'February' or 'february':
        print ('The next month will be March')

if month == 'March' or 'march':
            print ('The next month will be April')

if month == 'April' or 'april':
            print ('The next month will be May')

if month == 'June' or 'june':
            print ('The next month will be July')

if month == 'July' or 'july':
            print ('The next month will be August')

if month == 'August' or 'august':
            print ('The next month will be September')

if month == 'September' or 'september':
            print ('The next month will be October')

if month == 'October' or 'october':
            print ('The next month will be November')

if month == 'November' or 'november':
            print ('The next month will be December')

if month == 'December' or 'december':
            print ('The next month will be January')
elixenide
  • 44,308
  • 16
  • 74
  • 100

1 Answers1

0

Good syntax is:

if month == 'December' or month == 'december': 

Otherwise python will convert 'december' to a boolean and the result will be True (for any non empty string)

Julien
  • 13,986
  • 5
  • 29
  • 53