aboutsummaryrefslogtreecommitdiff
path: root/challenge-326/luca-ferrari/python/ch-1.py
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-326/luca-ferrari/python/ch-1.py')
-rw-r--r--challenge-326/luca-ferrari/python/ch-1.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-326/luca-ferrari/python/ch-1.py b/challenge-326/luca-ferrari/python/ch-1.py
new file mode 100644
index 0000000000..5e97d3206d
--- /dev/null
+++ b/challenge-326/luca-ferrari/python/ch-1.py
@@ -0,0 +1,23 @@
+#!python
+
+#
+# Perl Weekly Challenge 326
+# Task 1
+#
+# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-326>
+#
+
+import sys
+from datetime import datetime, date
+
+# task implementation
+# the return value will be printed
+def task_1( args ):
+ begin = datetime.strptime( args[ 0 ], "%Y-%m-%d").date()
+ end = date( begin.year, 1, 1 )
+ return abs( ( end - begin ).days )
+
+
+# invoke the main without the command itself
+if __name__ == '__main__':
+ print( task_1( sys.argv[ 1: ] ) )