aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2022-08-31 23:14:37 +0100
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2022-08-31 23:14:37 +0100
commit8949a7eb59a35c72175613a20e5451c2a42c0b77 (patch)
tree33d2c1173d07843ba7cdebf6d1331a5a657d43b5
parent8f8b2f39243c7b2565307bed3f82b84589c7f1ef (diff)
downloadperlweeklychallenge-club-8949a7eb59a35c72175613a20e5451c2a42c0b77.tar.gz
perlweeklychallenge-club-8949a7eb59a35c72175613a20e5451c2a42c0b77.tar.bz2
perlweeklychallenge-club-8949a7eb59a35c72175613a20e5451c2a42c0b77.zip
- Added guest contributions by Eric Cheung.
-rwxr-xr-xchallenge-180/eric-cheung/python/ch-1.py12
-rwxr-xr-xchallenge-180/eric-cheung/python/ch-2.py15
2 files changed, 27 insertions, 0 deletions
diff --git a/challenge-180/eric-cheung/python/ch-1.py b/challenge-180/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..72d5f1e1ca
--- /dev/null
+++ b/challenge-180/eric-cheung/python/ch-1.py
@@ -0,0 +1,12 @@
+##
+
+## strInput = "Perl Weekly Challenge" ## Example 1
+strInput = "Long Live Perl" ## Example 2
+
+for nIndex in range(0, len(strInput)):
+
+ ## print (strInput[nIndex])
+ if strInput.count(strInput[nIndex]) == 1:
+ print (nIndex)
+
+ break
diff --git a/challenge-180/eric-cheung/python/ch-2.py b/challenge-180/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..efee01d302
--- /dev/null
+++ b/challenge-180/eric-cheung/python/ch-2.py
@@ -0,0 +1,15 @@
+##
+
+import numpy as np
+
+## Example 1
+## arrList = np.array([1, 4, 2, 3, 5])
+## nVal = 3
+
+## Example 2
+arrList = np.array([9, 0, 6, 2, 3, 8, 5])
+nVal = 4
+
+nIndxArr = np.where(arrList > nVal)
+
+print (arrList[nIndxArr])