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 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,
}
uday = int(input("input a day"))
umonth = int(input("input a month"))
year = int(input("input a year"))
udate = str(umonth) + "/" + str(uday) + "/" + str(year)
print(udate)
rmonth = random.randint(1,12)
rdayrange = days_dictionary.get(rmonth)
rday = random.randint(0,rdayrange)
rdate = str(rmonth) + "/" + str(rday) + "/" + str(year)
print(rdate)
def absdays(month,day):
abs = 0
for i in range (1,month):
abs += (days_dictionary.get(i))
abs += day
return(abs)
uabs = absdays(umonth,uday)
rabs = absdays(rmonth,rday)
diff = abs(uabs - rabs)
print("there are " + str(diff) + " days between " + rdate + " and " + udate)