aboutsummaryrefslogtreecommitdiff
path: root/challenge-207/robert-dicicco/python/ch-1.py
blob: 850c89b0cef706629f6ed3c0c1dfba34a5e9a5c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#/usr/bin/env python
'''
--------------------------------------
AUTHOR: Robert DiCicco
DATE  : 2023-03-06
Challenge 207 Keyboard Word ( Python )
--------------------------------------
'''

rows = ["qwertyuiop", "asdfghjkl", "zxcvbnm"]
words = ["Hello", "Alaska", "Dad", "Peace"], ["OMG", "Bye"]
flag = 0

def CheckLetters(w):
    ln = len(w)
    for j in range(3):
        flag = 0
        for x in range(ln):
            if (w[x] in rows[j]):
                pass
            else:
                flag = 1
        if flag == 0 :
            print("\t",w)
        flag = 0

for wds in words:
    print("Input: @words = ",wds)
    print("Output: ")
    ln = len(wds)
    for j in range(0,ln):
        CheckLetters(wds[j].lower())
    print(" ")

'''
--------------------------------------
SAMPLE OUTPUT
python .\KeyboardWord.py
Input: @words =  ['Hello', 'Alaska', 'Dad', 'Peace']
Output:
         alaska
         dad

Input: @words =  ['OMG', 'Bye']
Output:

'''