Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Database Systems For Advanced Applications 15th International Conference Dasfaa 2010 International Workshops Gdm Benchmarx Mcis Snsmw Diew Udm Tsukuba Japan April 2010 Revised Selected Papers Lncs 6193

Authors: Masatoshi Yoshikawa ,Xiaofeng Meng ,Takayuki Yumoto ,Qiang Ma ,Lifeng Sun ,Chiemi Watanabe

2010th Edition

3642145884, 978-3642145889

More Books

Students also viewed these Databases questions

Question

6 Transfer tasks gently challenge the risk-averse. Discuss.

Answered: 1 week ago

Question

Determine miller indices of plane A Z a/2 X a/2 a/2 Y

Answered: 1 week ago

Question

You have

Answered: 1 week ago