TDT4109/Exercise 5/9 - Arbeidsdager/a.py

9 lines
335 B
Python
Raw Normal View History

2020-10-07 13:13:24 +02:00
from local import is_leap_year
def weekday_newyear(year):
daySum = sum([366 if is_leap_year(year) else 365 for year in range(year)])
return (daySum - 2) % 7
if __name__ == "__main__":
days = ['man', 'tir', 'ons', 'tor', 'fre', 'lor', 'son']
_ = [ print(f'{year} {days[weekday_newyear(year)]}') for year in range(1900, 1920) ]