Advertisement
Guest User

asdasd

a guest
Oct 15th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #We will assume the data structure with the valid four letter words is in a list.
  2.  
  3. import sys # To take command line arguements.
  4.  
  5. array = [hello]
  6.  
  7. inputNum = str(sys.argv[0])
  8.  
  9.  
  10. 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']]
  11.  
  12. for i = 0; i < len(array); i++ # iterating through the each valid word in array
  13.  
  14. for j = 0; j < len(my2DArray[numb]); j++ # iterates each possible thing the dial number could be and the letters in the word
  15. numb - 2 = inputNum[j] # accounting for the number starting at 2
  16. word = array[i] # narrow the word
  17. if(word[j] == my2DArray[numb][j]) # check if the letter in the word is = to one of the
  18. if(j + 1 == len(my2DArray[numb]))
  19. newArray.append(array[i])
  20. continue
  21. else if(j + 1 == len(my2DArray[numb]))
  22. i++
  23. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement