47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
import datetime
|
|
|
|
def num2day(num):
|
|
match num:
|
|
case 1:
|
|
return "Monday"
|
|
case 2:
|
|
return "Tuesday"
|
|
case 3:
|
|
return "Wednesday"
|
|
case 4:
|
|
return "Thursday"
|
|
case 5:
|
|
return "Friday"
|
|
|
|
def workWeek(yearPercent):
|
|
totalNumHours = 40*yearPercent
|
|
numDays = totalNumHours/8
|
|
hoursIntoDay = (numDays - round(numDays))*8
|
|
minutesIntoDay = round((hoursIntoDay - round(hoursIntoDay))*60)
|
|
return num2day(round(numDays+1)), round(hoursIntoDay)+9, minutesIntoDay
|
|
|
|
currentTime = datetime.datetime.now()
|
|
print (f"It is currently {currentTime.hour}:{currentTime.minute}, on {currentTime.day}/{currentTime.month}/{currentTime.year}.")
|
|
|
|
delta = currentTime - datetime.datetime(day=1,month=1,year=currentTime.year)
|
|
total_days = datetime.datetime(day=1,month=1,year=currentTime.year+1) - datetime.datetime(day=1,month=1,year=currentTime.year)
|
|
|
|
yearPercent = delta/total_days
|
|
print(f"We are {round(yearPercent*100,2)}% of the way through {currentTime.year}.")
|
|
|
|
print("To put that into context:")
|
|
|
|
print("If the year were")
|
|
|
|
print(" a 90 minute football match,")
|
|
print(f" it would be the {round(yearPercent*90)}th minute.")
|
|
|
|
day, hours, minutes = workWeek(yearPercent)
|
|
print(" a 40 hour work week,")
|
|
print(f" it would be {hours}:{minutes} on {day}.")
|
|
|
|
#abbey road
|
|
#marathon world record
|
|
#the hobbit
|
|
|