[2024-08-09] Initial commit, text-based
Need to use strftime and the time module to properly format the times
This commit is contained in:
commit
1e7dc22074
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.year-progress
|
46
year-progress.py
Normal file
46
year-progress.py
Normal file
@ -0,0 +1,46 @@
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user