Я делаю игру похожей на текстовое завихрение на python, и мне было интересно, как предотвратить возможность ввода пользователем одного и того же слова дважды. Вот то, что я до сих пор ...Запретить пользователю вводить один и тот же ввод дважды
import random
correct = 0
incorrect = 0
usedwords = []
print 'Welcome to text twist, you have 14 guesses to get 7 words made up of 4, 5 or 6 letters. Good Luck!'
for i in range(14):
print "Your letters are 'E' 'P' 'L' 'B' 'E' 'B', what is your guess?"
answer = raw_input()
if answer in usedwords:
print "Sorry, you've already used this word"
if answer == 'belle' or answer == 'bleep' or answer == 'pebble' or answer == 'beep' or answer == 'bell' or answer == 'peel' or answer == 'peep':
if answer in usedwords:
print 'Nice that was one of the words!'
usedwords.append(answer)
correct = correct + 1
if answer != 'belle' and answer != 'bleep' and answer != 'pebble' and answer != 'beep' and answer != 'bell' and answer != 'peel' and answer != 'peep':
print 'Sorry, that was not one of the words.'
incorrect = incorrect + 1
print 'Your final score was', correct, 'correct and', incorrect, 'wrong.'
Вы забыли вставить свой код – Selcuk