这是自己已经写得代码
#This is a hacking program
CorrectAnswer='HUNTING'
def displayInstruction(): #Displays instructions
print('A group of possible passwords will be displayed.')
print('You must guess the password.You have at most 4 guesses.')
print('your guess were in exactly the correct location of the passwrod.')
guesses=4
def displaywords(): #Displays words
for word in words:
print(word)
words=['PROVIDE','SETTING','CANTINA','CUTTING','HUNTERS','SURVIVE',\
'HEARING','HUNTING','REALIZE','NOTHING','OVERLAP','FINDING',\
'PUTTING']
count=0
displayInstruction()
displaywords()
while guesses>0:
playsAnswer=input('Enter password '+str(guesses)+' guesses remaining> ')
if playsAnswer==CorrectAnswer:
print('User login successful')
break
else:
if guesses>=1:
print('Password Incorrect')
guesses = guesses - 1
if guesses==0:
print('User login unsuccessful')