Question: Write a program that asks the user for a number in the range of 1 through 7. The program should display the corresponding day of

Write a program that asks the user for a number in the range of 1 through 7. The program should display the corresponding day of the week where 1 = Monday, 2= Tuesday, etc....The program should display an error message if the user enters a number that is outside the range of 1 through 7

SOLUTION:

# Get the number for the day of the week. day = int(input('Enter a number (1-7) for the day of the week: '))

# Determine the name of the day of the week, and display it. if day == 1: print('Monday') elif day == 2: print('Tuesday') elif day == 3: print('Wednesday') elif day == 4: print ('Thursday') elif day == 5: print ('Friday') elif day == 6: print ('Saturday') elif day == 7: print ('Sunday') else: print ('Error: Please enter a number in the range 1-7.')

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!