If I am constantly adding in strings from a user's input. How can I check that once a string has been added into a list, the contents has already been inside?
x = 4
y = 9
repeatList = []
abc = str(x)+str(y)
repeatList.append(abc)
x = 3
y = 2
abc = str(x)+str(y)
repeatList.append(abc)
x = 4
y = 9
abc = str(x)+str(y)
repeatList.append(abc)
print(repeatList)
Gives an output:
['49', '32', '49']
The desired output is ['49','32']
and a message "You have inputted '49' already."
Please note in the actual code we do not assign variables to an int, instead, we allow the player to input and if they've already written it before then we let them know they have typed in the same input and that they still lose a 'move'.