Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I keep getting a Traceback error, can someone help me fix that? There may be additional errors, but I can't get past that one too.

I keep getting a Traceback error, can someone help me fix that? There may be additional errors, but I can't get past that one too. EOFError: EOF when reading a line

SCENARIO:

Have a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day.

Ex: If the input is:

April 11 

the output is:

Spring 

In addition, check if the string and int are valid (an actual month and day).

Ex: If the input is:

Blue 65 

the output is:

Invalid 

The dates for each season are:

Spring: March 20 - June 20

Summer: June 21 - September 21

Autumn: September 22 - December 20

Winter: December 21 - March 19

MY CODE:

input_month = input()

input_day = int(input())

if input_month == 'March' and 20 <= input_day <= 31\

or input_month == 'April' and 1 <= input_day <= 30\

or input_month == 'May' and 1 <= input_day <= 31\

or input_month == 'June' and 1 <= input_day <= 20:

print('Spring')

elif input_month == 'June' and 21 <= input_day <= 30\

or input_month == 'July' and 1 <= input_day <= 31\

or input_month == 'August' and 1 <= input_day <= 31\

or input_month == 'September' and 1 <= input_day <= 30:

print('Summer')

elif input_month == 'September' and 22 <= input_day <= 30\

or input_month == 'October' and 1 <= input_day <= 31\

or input_month == 'November' and 1 <= input_day <= 30\

or input_month == 'December' and 1 <= input_day <= 20:

print('Autumn')

elif input_month == 'December' and 21 <= input_day <= 31\

or input_month == 'January' and 1 <= input_day <= 31\

or input_month == 'February' and 1 <= input_day <= 28\

or input_month == 'March' and 1 <= input_day <= 19:

print('Winter')

else:print('Invalid')

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions