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 124: 4.21

Answer

$Code$

Work Step by Step

$Code:$ year = int(input("Enter yeaer:(e.g, 2012)")) month = int(input("enter month: 1-12")) dayOfMonth = int(input("Enter the day of month:1-31:")) if month == 1 or month == 2: $ $ $ $ month = 13 if (month == 1) else 14 $ $ $ $ year = year - 1 dayOfWeek = (dayOfMonth + (26 * month + 1)) / 10 + (year % 100) + (year % 100) / 4 + (year / 100) / 4 + 5 * (year / 100) % 7 print("day of week is ") if dayOfWeek == 0: $ $ $ $ print("saturday") elif dayOfWeek == 1: $ $ $ $ print("Sunday") elif dayOfWeek == 2: $ $ $ $ print("Monday") elif dayOfWeek == 3: $ $ $ $ print("Tuesday") elif dayOfWeek == 4: $ $ $ $ print("Wednesday") elif dayOfWeek == 5: $ $ $ $ print("Thursday") else: $ $ $ $ print("Friday") $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.