Created
October 8, 2021 22:53
-
-
Save montali/763b97d8f0174acf74292c3efc158b3a to your computer and use it in GitHub Desktop.
Flat180's big average birthday party
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
birthdays = { | |
"Simmy": datetime.date(2021, 10, 1), | |
"Mike": datetime.date(2021, 9, 9), | |
"Isa": datetime.date(2021, 10, 6), | |
"Ava": datetime.date(2021, 12, 29), | |
"Wanik": datetime.date(2021, 2, 27), | |
"Riley": datetime.date(2021, 2, 3), | |
"Evan": datetime.date(2021, 10, 24), | |
"Alvaro": datetime.date(2021, 10, 21), | |
"Klemen": datetime.date(2021, 10, 29), | |
"Lukas": datetime.date(2021, 9, 23), | |
"Michal": datetime.date(2021, 6, 28), | |
} | |
sum = 0 | |
for birthday in birthdays.values(): | |
sum += birthday.timetuple().tm_yday - 232 | |
avg = sum / len(birthdays) | |
avg = datetime.datetime(2021, 1, 1) + datetime.timedelta(int(avg) - 1) | |
print(f"Average is {avg}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment