diff options
| author | Dave Jacoby <jacoby.david@gmail.com> | 2023-07-31 09:33:10 -0400 |
|---|---|---|
| committer | Dave Jacoby <jacoby.david@gmail.com> | 2023-07-31 09:33:10 -0400 |
| commit | ecd08452c0bc55f0072f8d260ec830d4ec8cccc9 (patch) | |
| tree | 9ba31f20e804820e13ae16d0ab4491d93e5c9313 /challenge-227/robert-dicicco/python/ch-1.py | |
| parent | 9a38bd2ff080991f73d7f49cebf2fbab06c69d94 (diff) | |
| parent | e511966ce2280dbedb2c916d9e6254708800639e (diff) | |
| download | perlweeklychallenge-club-ecd08452c0bc55f0072f8d260ec830d4ec8cccc9.tar.gz perlweeklychallenge-club-ecd08452c0bc55f0072f8d260ec830d4ec8cccc9.tar.bz2 perlweeklychallenge-club-ecd08452c0bc55f0072f8d260ec830d4ec8cccc9.zip | |
Merge branch 'master' of https://github.com/manwar/perlweeklychallenge-club
Diffstat (limited to 'challenge-227/robert-dicicco/python/ch-1.py')
| -rw-r--r-- | challenge-227/robert-dicicco/python/ch-1.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/challenge-227/robert-dicicco/python/ch-1.py b/challenge-227/robert-dicicco/python/ch-1.py new file mode 100644 index 0000000000..20c8ed326e --- /dev/null +++ b/challenge-227/robert-dicicco/python/ch-1.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +''' +------------------------------------- +AUTHOR: Robert DiCicco +DATE : 2023-07-24 +Challenge 227 Task 1 Friday 13th ( Python ) +------------------------------------- +''' + +from datetime import date +import sys + +n = len(sys.argv) +if n == 1: + print("Please select a year between 1753 and 9999") + sys.exit(0) + +year = int(sys.argv[1]) +if year < 1753 or year > 9999: + print("Please select a year between 1753 and 9999") + sys.exit(0) + +for month in range(1,12): + d = date(year, month, 13) + wd = d.weekday() + if wd == 4: # Monday = 0, Sunday = 6 + print(f"{year} {month} 13 is a Friday") + month += 1 + +''' +------------------------------------- +SAMPLE OUTPUT +python .\Friday13.py 2023 + +2023 1 13 is a Friday +2023 10 13 is a Friday + +python .\Friday13.py 1753 + +1753 4 13 is a Friday +1753 7 13 is a Friday +------------------------------------- +''' + + + + + + + + + |
