diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-03-08 23:32:11 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-03-08 23:32:11 +0000 |
| commit | a0ea2c78c8ac2bb33fb79ab151f86b3beb143647 (patch) | |
| tree | 41cbffecd69bd6774b09657b5702f620154cf9cb /challenge-207/eric-cheung/python/ch-1.py | |
| parent | bc577f09f07be6abd72291c3e9a6642e4336d9c9 (diff) | |
| download | perlweeklychallenge-club-a0ea2c78c8ac2bb33fb79ab151f86b3beb143647.tar.gz perlweeklychallenge-club-a0ea2c78c8ac2bb33fb79ab151f86b3beb143647.tar.bz2 perlweeklychallenge-club-a0ea2c78c8ac2bb33fb79ab151f86b3beb143647.zip | |
- Added solutions by Avery Adams.
- Added solutions by Jaldhar H. Vyas.
- Added solutions by Mark Anderson.
- Added solutions by Luca Ferrari.
- Added solutions by Peter Campbell Smith.
- Added solutions by W. Luis Mochan.
- Added solutions by Paulo Custodio.
- Added solutions by Cheok-Yin Fung.
- Added solutions by E. Choroba.
- Added solutions by Bob Lied.
- Added solutions by Robbie Hatley.
- Added solutions by Matthias Muth.
- Added solutions by Lubos Kolouch.
- Added solutions by Solathian.
- Added solutions by Duncan C. White.
- Added solutions by Kjetil Skotheim.
- Added solutions by Marton Polgar.
- Added solutions by David Ferrone.
- Added solutions by Mariano Spadaccini.
- Added solutions by Robert DiCicco.
- Added solutions by Ulrich Rieke.
- Added solutions by Laurent Rosenfeld.
Diffstat (limited to 'challenge-207/eric-cheung/python/ch-1.py')
| -rwxr-xr-x | challenge-207/eric-cheung/python/ch-1.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/challenge-207/eric-cheung/python/ch-1.py b/challenge-207/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..57ddd9e817 --- /dev/null +++ b/challenge-207/eric-cheung/python/ch-1.py @@ -0,0 +1,30 @@ +
+arrKeyBoardRow = ["qwertyuiop", "asdfghjkl", "zxcvbnm"]
+
+arrInputWords = ["Hello", "Alaska", "Dad", "Peace"] ## Example 1
+## arrInputWords = ["OMG", "Bye"] ## Example 2
+
+arrKeyBoardChar = []
+for arrLoop in arrKeyBoardRow:
+ arrKeyBoardChar.append(list(arrLoop))
+
+arrOutputWords = []
+
+for arrLoop in arrInputWords:
+
+ strLoopLower = arrLoop.lower()
+
+ for nIndx in range(0, len(arrKeyBoardChar)):
+ if strLoopLower[0] in arrKeyBoardChar[nIndx]:
+ break
+
+ bSameRow = True
+ for nLoop in range(1, len(arrLoop)):
+ if strLoopLower[nLoop] not in arrKeyBoardChar[nIndx]:
+ bSameRow = False
+ break
+
+ if bSameRow:
+ arrOutputWords.append(arrLoop)
+
+print (arrOutputWords)
|
