Unit 3 Sections 14-15 Homework
Here are the instructions for the homework for sections 14-15.
Create a program that asks the user for a day and then gives them a distance in days between that day and another random day in the year. We have provided you with a possible starter, but you are welcome to change it up if you would like.
import datetime
from random import randint
year = int(input("Enter a year: "))
month = int(input("Enter a month (1-12): "))
day = int(input("Enter a day (1-28): "))
user_date = datetime.date(year, month, day)
random_date = datetime.date(year, randint(1, 12), randint(1, 28))
difference = abs(random_date - user_date)
print("The number of days between {} and {} is: {}".format(user_date, random_date, difference.days))