Write a program that prompts the user to enter a date, using integer values for the month, day, and year, and then prints out the day of the week that fell on that date. According to the Gregorian Calendar, January 1, 1601 was a Monday. Observe all leap years (and keep in mind that 1700, 1800, and 1900 were not leap years).

Respuesta :

Answer:

import datetime

user = input("Enter date in yyyy,m,d: ").split(",")

int_date = tuple([int(x) for x in user])

year, month, day =int_date

mydate = datetime.datetime(year, month, day)

print(mydate)

x = mydate.strftime("%B %d, %Y was a %A")

print(x)

Explanation:

The datetime python module is used to create date and time objects which makes it easy working with date-time values. The user input is converted to a tuple of integer items, then they are converted to date time objects and parsed to string with the strftime method.