diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-07-13 00:32:50 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2022-07-13 00:32:50 +0100 |
| commit | 864b28b1a7417493ab8f94934e491909576230da (patch) | |
| tree | 1e50b488dd16be1bac083b2ac7582d2c0eb497e3 | |
| parent | 0e4a6d30ada4b3831d4ce45dbaeefb8a1cc02fb5 (diff) | |
| download | perlweeklychallenge-club-864b28b1a7417493ab8f94934e491909576230da.tar.gz perlweeklychallenge-club-864b28b1a7417493ab8f94934e491909576230da.tar.bz2 perlweeklychallenge-club-864b28b1a7417493ab8f94934e491909576230da.zip | |
- Added guest contributions by Eric Cheung.
| -rwxr-xr-x | challenge-173/eric-cheung/python/ch-1.py | 15 | ||||
| -rwxr-xr-x | challenge-173/eric-cheung/python/ch-2.py | 18 |
2 files changed, 33 insertions, 0 deletions
diff --git a/challenge-173/eric-cheung/python/ch-1.py b/challenge-173/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..91d5ea0629 --- /dev/null +++ b/challenge-173/eric-cheung/python/ch-1.py @@ -0,0 +1,15 @@ +
+
+def IsEstheticNumber(nNum):
+
+ strNum = str(nNum)
+ for nLoop in range(0, len(strNum) - 1):
+ ## print (strNum[nLoop] + " " + strNum[nLoop + 1])
+ if abs(int(strNum[nLoop]) - int(strNum[nLoop + 1])) != 1:
+ return False
+
+ return True
+
+## print (IsEstheticNumber(5456))
+print (IsEstheticNumber(120))
+
diff --git a/challenge-173/eric-cheung/python/ch-2.py b/challenge-173/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..c8fc4d3c6e --- /dev/null +++ b/challenge-173/eric-cheung/python/ch-2.py @@ -0,0 +1,18 @@ +
+
+def getProdFromArr(arrInput):
+ nProd = 1
+ for xLoop in arrInput:
+ nProd = nProd * xLoop
+
+ return nProd
+
+arrSylvesterSeq = []
+
+arrSylvesterSeq.append(2)
+
+while len(arrSylvesterSeq) < 10:
+
+ arrSylvesterSeq.append(getProdFromArr(arrSylvesterSeq) + 1)
+
+print (arrSylvesterSeq)
|
