aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2020-02-18 12:06:40 +0000
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2020-02-18 12:06:40 +0000
commita17d8c1ad84fbdd4d42e6e9e846fcb24990791cc (patch)
tree3932dfb9816330dfef7920fbd1af6960152136a4
parent2a7419ce4a955450cb83e90732ae46540b438c33 (diff)
downloadperlweeklychallenge-club-a17d8c1ad84fbdd4d42e6e9e846fcb24990791cc.tar.gz
perlweeklychallenge-club-a17d8c1ad84fbdd4d42e6e9e846fcb24990791cc.tar.bz2
perlweeklychallenge-club-a17d8c1ad84fbdd4d42e6e9e846fcb24990791cc.zip
- Added Python solutions by Orestis Zekai.
-rw-r--r--challenge-048/orestis-zekai/python/ch-1.py9
-rw-r--r--challenge-048/orestis-zekai/python/ch-2.py21
2 files changed, 30 insertions, 0 deletions
diff --git a/challenge-048/orestis-zekai/python/ch-1.py b/challenge-048/orestis-zekai/python/ch-1.py
new file mode 100644
index 0000000000..a2f947879a
--- /dev/null
+++ b/challenge-048/orestis-zekai/python/ch-1.py
@@ -0,0 +1,9 @@
+N = 50
+people = [i for i in range(0, N)]
+while len(people) > 1:
+ tmp = people[0]
+ del people[0]
+ del people[0]
+ people.append(tmp)
+
+print('Last man standing is: ' + str(people[0] + 1)) \ No newline at end of file
diff --git a/challenge-048/orestis-zekai/python/ch-2.py b/challenge-048/orestis-zekai/python/ch-2.py
new file mode 100644
index 0000000000..6580f45670
--- /dev/null
+++ b/challenge-048/orestis-zekai/python/ch-2.py
@@ -0,0 +1,21 @@
+from datetime import date, timedelta
+
+sdate = date(2000, 1, 1)
+edate = date(2999, 12, 31)
+
+delta = edate - sdate
+c = 1
+for i in range(delta.days + 1):
+ day = sdate + timedelta(days=i)
+ str_month = str(day.month)
+ if (day.month < 10):
+ str_month = '0' + str_month
+ str_day = str(day.day)
+ if (day.day < 10):
+ str_day = '0' + str_day
+
+ str_date = str_month + str_day + str(day.year)
+
+ if (str_date == str_date[::-1]):
+ print(str(c) + ': Palindrome ' + str(day) + ' ( ' + str_date + ' )')
+ c += 1 \ No newline at end of file