Question: Homeworks are done in the following periods of a day: morning, afternoon, evening. These periods refer to the following time intervals of a day:

Homeworks are done in the following periods of a day: morning, afternoon,

Homeworks are done in the following periods of a day: morning, afternoon, evening. These periods refer to the following time intervals of a day: Morning period: [7, 11], both 7 and 11 are included. Afternoon period: [13, 17], both 13 and 17 are included. Evening period: [19, 23], both 19 and 23 are included. An hour value that does not fall in any of the above time intervals is not a time to do homework, so such an hour is considered invalid. Write a Python script that performs the following: The script gets from the user 10 inputs each referring to the hour value a homework is done. Based on the hour value entered, the script decides and prints its corresponding period (For example, if the input value is 9, the corresponding period to be printed will be "Morning"). The script prints the related period for each input value. If an input is invalid, the script should print a warning message and insist on a valid input till the user enters correctly for that iteration. At the end, the script prints the number of homeworks done in each period (For example, 2 homeworks in Morning period, 6 homeworks in Afternoon period, 2 homeworks in Evening period).

Step by Step Solution

3.42 Rating (146 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Since the app wont support empty spaces all the underscores represent the spaces for indent... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!