aboutsummaryrefslogtreecommitdiff
path: root/challenge-227/robert-dicicco/python/ch-1.py
diff options
context:
space:
mode:
author冯昶 <fengchang@novel-supertv.com>2023-07-31 15:49:22 +0800
committer冯昶 <fengchang@novel-supertv.com>2023-07-31 15:49:22 +0800
commite7b6313261ef4541d4dcc303c46ef0d886649b70 (patch)
tree8cff819a2036dd8d0172b6343b0a199d7b81721a /challenge-227/robert-dicicco/python/ch-1.py
parent4fda4a4a398e64921020704733556a2ec6dae78a (diff)
parente511966ce2280dbedb2c916d9e6254708800639e (diff)
downloadperlweeklychallenge-club-e7b6313261ef4541d4dcc303c46ef0d886649b70.tar.gz
perlweeklychallenge-club-e7b6313261ef4541d4dcc303c46ef0d886649b70.tar.bz2
perlweeklychallenge-club-e7b6313261ef4541d4dcc303c46ef0d886649b70.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-227/robert-dicicco/python/ch-1.py')
-rw-r--r--challenge-227/robert-dicicco/python/ch-1.py52
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
+-------------------------------------
+'''
+
+
+
+
+
+
+
+
+