I've been making a function to search through two lists and check if a character is in both lists.The error
"IndexError: list index out of range"
keeps coming up. I put this through python Tutor and it seems like the while loop is totally ignored.I'm coding this search without using the in function in an if statement. Any help would be much appreciated!
Here is my code:
aList = ["B" , "S" , "N" , "O" , "E" , "U" , "T" ]
userInput = "TOE"
userInputList = list(userInput)
letterExists = 0
while (letterExists < len(userInput)):
for i in aList:
if (i == userInputList[letterExists]):
letterExists +=1
if (letterExists == len(userInput)):
print("This word can be made using your tiles")