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.
from datetime import date
import random
days_dictionary = {
1: 31,
2: 28,
3: 31,
4: 30,
5: 31,
6: 30,
7: 31,
8: 31,
9: 30,
10: 31,
11: 30,
12: 31,
}
y1 = int(input("Enter a year here: "))
m1 = int(input("Enter a month here: "))
d1 = int(input("Enter a day here: "))
y2 = random.randint(2000,2022)
m2 = random.randint(1,12)
d2 = random.randint(1,31)
print(str(m1 - m2) + " / " + str(d1 - d2) + " / " + str(y1 - y2))
# I tried it but was stuck on how to call the dictionary when finding the difference in dates