Question

In: Computer Science

Do Programming Exercise 1 (Day of the Week) – Page 151 Output should look like this.....

Do Programming Exercise 1 (Day of the Week) – Page 151 Output should look like this.. >>> =RESTART: C:/Users/gamada/AppData/Local/Programs/python/python36/week/py= what is your name? gamada Enter a number (1-7) for the day of the week: 3 you selected 3 which is wednesday

Solutions

Expert Solution

Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks

#code

#creating a list that contain names of all 7 days
days=['monday','tuesday','wednesday','thursday','friday','saturday','sunday']
#reading name
name=input('what is your name? ')
#reading day of week (converting from string to int)
day=int(input('Enter a number (1-7) for the day of the week: '))
#validating day
if day<1 or day>7:
    #invalid
   
print('Invalid day')
else:
    #valid, displaying day and name of day, which is stored at
    #index day-1 (list indices start from 0) in days list
   
print('you selected '+str(day)+' which is '+days[day-1])

#output

what is your name? oliver

Enter a number (1-7) for the day of the week: 3

you selected 3 which is wednesday


Related Solutions

1 What do the hedging alternatives look like given the following information for a 90-day, 1,000,000...
1 What do the hedging alternatives look like given the following information for a 90-day, 1,000,000 account receivable? Spot rate: 1.4 to 1 domestic to foreign 90-day forward rate: 1.3 to 1 Money market periodic: 0.1% OTC Option with strike price of 1.35 to 1 at a cost of 0.5%
afe Rational Fractions In week 4 we completed Chapter 13 Programming Exercise #10 Page 974. Make...
afe Rational Fractions In week 4 we completed Chapter 13 Programming Exercise #10 Page 974. Make sure you have a working fractionType class before starting this assignment. The template requirement from week 4 is not required for this assignment. Your assignment this week is to make your fractionType class safe by using exception handling. Use exceptions so that your program handles the exceptions division by zero and invalid input. An example of invalid input would be entering a fraction such...
This week we are going to look at how benchmarking is used in the current day...
This week we are going to look at how benchmarking is used in the current day health care industry! Please find a current events (within the past year) news article from a reputable news source (MSN, New York Times, Chicago Tribune, etc) that discusses the use of benchmarking by a health care organization. For your original post, please provide a 150+ word summary of your article. Be sure that you demonstrate your understanding of benchmarking by discussing how the benchmarking...
1. What would the regression output (analysis) look like using this multiple regression equation and the...
1. What would the regression output (analysis) look like using this multiple regression equation and the following data? Daily Gross Revenue= total daily income+b1*daily tour income+b2*number of tourists+b3*Friday+b4*Saturday 2. What's the multiple regression equation with the numbers from the output? Years Weekend Daily Tour Income Number of Tourists Daily Gross Revenue Total Daily Income 1 Friday 3378 432 4838.95 8216.95 1 Saturday 1198 139 3487.78 4685.78 1 Sunday 3630 467 4371.3 8001.3 2 Friday 4550 546 6486.48 11036.48 2 Saturday...
How to print these methods in a separate main class? need the output to look like...
How to print these methods in a separate main class? need the output to look like this: Enter three integers whose GCD is to be found -> Enter an integer n to find the nth Fibonacci number -> Enter the base and exponent , an integer, of a power -> Enter two positive integers 1 and j where i < j -> gcd() = fib() = (a number ^ a number) = a number There are ___ palindromic numbers between...
1. What do demand and marginal revenue curves look like in monopolistic competition? How do they...
1. What do demand and marginal revenue curves look like in monopolistic competition? How do they compare to the demand and marginal revenue curves in perfect competition and monopoly?
Modify the following code to make the input and output look like this. Input 5 Vader...
Modify the following code to make the input and output look like this. Input 5 Vader 1300 Kirk 1250 Adama 1000 Reynolds 1615 Oneill 1470 Output Enter the number of candidates: 5 Enter candidate's name :Vader 1300 Enter votes received :Enter candidate's name :Kirk 1250 Enter votes received :Enter candidate's name :Adama 1000 Enter votes received :Enter candidate's name :Reynolds 1615 Enter votes received :Enter candidate's name :Oneill 1470 Enter votes received : Name Votes Percentage Vader 1300.00 19.59% Kirk...
what should the indifference curve between income and crime look like?
what should the indifference curve between income and crime look like?
(a) Susan tries to exercise at ”Pure Fit” Gym each day of the week, except on...
(a) Susan tries to exercise at ”Pure Fit” Gym each day of the week, except on the weekends (Saturdays and Sundays). Susan is able to exercise, on average, on 75% of the weekdays (Monday to Friday). i. Find the expected value and the standard deviation of the number of days she exercises in a given week. [2 marks] ii. Given that Susan exercises on Monday, find the probability that she will exercise at least 3 days in the rest of...
. (a) Susan tries to exercise at ”Pure Fit” Gym each day of the week, except...
. (a) Susan tries to exercise at ”Pure Fit” Gym each day of the week, except on the weekends (Saturdays and Sundays). Susan is able to exercise, on average, on 75% of the weekdays (Monday to Friday). i. Find the expected value and the standard deviation of the number of days she exercises in a given week. [2 marks] ii. Given that Susan exercises on Monday, find the probability that she will exercise at least 3 days in the rest...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT