Created
June 2, 2021 18:46
-
-
Save jdmichaud/73e38f3322ec5f5b7b071cbed177c1c0 to your computer and use it in GitHub Desktop.
Compute the number of jours feries between 2000 and 2030 in France
This file contains hidden or 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
| from functools import reduce | |
| from datetime import datetime | |
| from jours_feries_france import JoursFeries | |
| def computeJoursFeries(year): | |
| return reduce( | |
| lambda acc, day: acc + 1 if day.isoweekday() != 6 and day.isoweekday() != 7 else acc, | |
| JoursFeries.for_year(year).values(), | |
| 0, | |
| ) | |
| if __name__ == '__main__': | |
| for (year, nb_of_ferie) in ([ | |
| (year + index, computeJoursFeries(year + index)) | |
| for (index, year) in enumerate([2000] * 30) | |
| ]): | |
| print(f'{year}: {nb_of_ferie}') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment