From a17d8c1ad84fbdd4d42e6e9e846fcb24990791cc Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Tue, 18 Feb 2020 12:06:40 +0000 Subject: - Added Python solutions by Orestis Zekai. --- challenge-048/orestis-zekai/python/ch-1.py | 9 +++++++++ challenge-048/orestis-zekai/python/ch-2.py | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 challenge-048/orestis-zekai/python/ch-1.py create mode 100644 challenge-048/orestis-zekai/python/ch-2.py 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 -- cgit