Adopted new convention from template

This commit is contained in:
David Doblas Jiménez 2022-09-26 20:47:12 +02:00
parent 67b0f93a17
commit 67120f400e

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3 #!/usr/bin/env python
""" """
Created on 15 Sep 2018 Created on 15 Sep 2018
@ -10,6 +10,7 @@ https://projecteuler.net/problem=19
""" """
from datetime import date from datetime import date
from utils import timeit from utils import timeit
@ -31,14 +32,14 @@ def compute():
How many Sundays fell on the first of the month during the twentieth How many Sundays fell on the first of the month during the twentieth
century (1 Jan 1901 to 31 Dec 2000)? century (1 Jan 1901 to 31 Dec 2000)?
""" """
sundays = 0 sundays = 0
for y in range(1901, 2001): for year in range(1901, 2001):
for m in range (1, 13): for month in range(1, 13):
if date(y, m, 1).weekday() == 6: if date(year, month, 1).weekday() == 6:
sundays += 1 sundays += 1
return sundays return sundays
if __name__ == "__main__": if __name__ == "__main__":
print(f"Result for Problem 19 is {compute()}")
print(f"Result for Problem 19: {compute()}")