Introduction to Programming using Python 1st Edition

Published by Pearson
ISBN 10: 0132747189
ISBN 13: 978-0-13274-718-9

Chapter 4 - Selections - Programming Exercises - Page 121: 4.5

Answer

$Code:$

Work Step by Step

$Code:$ date = int(input("Enter todat's date:")) elapsed = int(input("Enter the number of days elapsed since today: ")) future_date = (date + elapsed) % 7 day_of_week = "" if date == 0: $ $ $ $ $ $ $ $ day_of_week = "Sunday" elif date == 1: $ $ $ $ $ $ $ $ day_of_week = "Monday" elif date == 2: $ $ $ $ $ $ $ $ day_of_week = "Tuesdat" elif date == 3: $ $ $ $ $ $ $ $ day_of_week = "Wednesday" elif date == 4: $ $ $ $ $ $ $ $ day_of_week = "Thursday" elif date == 5: $ $ $ $ $ $ $ $ day_of_week = "Friday" elif date == 6: $ $ $ $ $ $ $ $ day_of_week = "Saturday" if (future_date == 0): $ $ $ $ $ $ $ $ print("Todays is {} and the future day is Sunday".format(day_of_week)) elif (future_date == 1): $ $ $ $ $ $ $ $ print("Todays is {} and the future day is Monday".format(day_of_week)) elif (future_date == 2): $ $ $ $ $ $ $ $ print("Todays is {} and the future day is Tuesday".format(day_of_week)) elif (future_date == 3): $ $ $ $ $ $ $ $ print("Todays is {} and the future day is Wednesday".format(day_of_week)) elif (future_date == 4): $ $ $ $ $ $ $ $ print("Todays is {} and the future day is Thursday".format(day_of_week)) elif (future_date == 5): $ $ $ $ $ $ $ $ print("Todays is {} and the future day is Friday".format(day_of_week)) elif (future_date == 6): $ $ $ $ $ $ $ $ print("Todays is {} and the future day is Saturday".format(day_of_week)) $Output:$
Update this answer!

You can help us out by revising, improving and updating this answer.

Update this answer

After you claim an answer you’ll have 24 hours to send in a draft. An editor will review the submission and either publish your submission or provide feedback.