aboutsummaryrefslogtreecommitdiff
path: root/challenge-173/walt-mankowski/python
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2022-07-17 17:58:13 +0100
committerGitHub <noreply@github.com>2022-07-17 17:58:13 +0100
commit783cee96dc5dd6ac008e5122b024ff46d56e85e5 (patch)
treec1d3865237c23a8eef465fd1689bcabe4910923f /challenge-173/walt-mankowski/python
parentb63d8d5dee6a54d5429b7c200db0b06420de52c0 (diff)
parent45f08a5e1866678d6ac9e42e30afd3a1d5d53fe6 (diff)
downloadperlweeklychallenge-club-783cee96dc5dd6ac008e5122b024ff46d56e85e5.tar.gz
perlweeklychallenge-club-783cee96dc5dd6ac008e5122b024ff46d56e85e5.tar.bz2
perlweeklychallenge-club-783cee96dc5dd6ac008e5122b024ff46d56e85e5.zip
Merge pull request #6455 from waltman/branch-for-challenge-173-python
Branch for challenge 173 python
Diffstat (limited to 'challenge-173/walt-mankowski/python')
-rw-r--r--challenge-173/walt-mankowski/python/ch-1.py14
-rw-r--r--challenge-173/walt-mankowski/python/ch-2.py9
2 files changed, 23 insertions, 0 deletions
diff --git a/challenge-173/walt-mankowski/python/ch-1.py b/challenge-173/walt-mankowski/python/ch-1.py
new file mode 100644
index 0000000000..f987ce2eff
--- /dev/null
+++ b/challenge-173/walt-mankowski/python/ch-1.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+import sys
+
+def is_esthetic(n):
+ d = [int(c) for c in str(n)]
+ for i in range(1, len(d)):
+ if abs(d[i-1]-d[i]) != 1:
+ return False
+ return True
+
+n = int(sys.argv[1])
+print(f'{n} {"is" if is_esthetic(n) else "is not"} an esthetic number')
+
+
diff --git a/challenge-173/walt-mankowski/python/ch-2.py b/challenge-173/walt-mankowski/python/ch-2.py
new file mode 100644
index 0000000000..e12d79a883
--- /dev/null
+++ b/challenge-173/walt-mankowski/python/ch-2.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+from functools import reduce
+
+sylvester = []
+while len(sylvester) < 10:
+ sylvester.append(reduce(lambda x,y: x*y, sylvester, 1) + 1)
+
+for syl in sylvester:
+ print(syl)