Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #We will assume the data structure with the valid four letter words is in a list.
- import sys # To take command line arguements.
- array = [hello]
- inputNum = str(sys.argv[0])
- my2DArray = [['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i'], ['j', 'k', 'l'], ['m', 'n', 'o'], ['p', 'q', 'r', 's'], ['t', 'u', 'v'], ['w', 'x', 'y', 'z']]
- for i = 0; i < len(array); i++ # iterating through the each valid word in array
- for j = 0; j < len(my2DArray[numb]); j++ # iterates each possible thing the dial number could be and the letters in the word
- numb - 2 = inputNum[j] # accounting for the number starting at 2
- word = array[i] # narrow the word
- if(word[j] == my2DArray[numb][j]) # check if the letter in the word is = to one of the
- if(j + 1 == len(my2DArray[numb]))
- newArray.append(array[i])
- continue
- else if(j + 1 == len(my2DArray[numb]))
- i++
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement