My python code:
possible1=["which","there","their","about","would","these","other","words","could","write",
"first","water","after","where","right","think","three","years","place","sound","great",
"again","still","every","small","found","those","never","under","might","while","house",
"world","below","asked","going","large","until","along"]
def DeleteNotPossiblePattern(guess,possibilities,pattern):
for i in range(len(pattern)):
print(f'Pattern: {pattern[i]} Letter: {guess[i]}')
if pattern[i]=="G":
print("The option: G")
for j in possibilities:
if guess[i]!=j[i]:
print(f'In word {j} the letter on {i+1} position is not equal')
try:
possibilities.remove(j)
except ValueError:
pass
return possibilities
k=DeleteNotPossiblePattern("tares",possible1,"GWWWW")
In code it's supposed to return list of words, which will have letter "t" as start and remove all other words from the list, however, it gives wrong results. I can't see where I am making the mistake.