#This program will play a little game
import random
secretnames = ([], [], [], [], [], [])
print('Hi. Please enter your name in letters')
name = str(input())
print('Hi ' + name + '. I am going to play a little game. In this game you have to guess a specific name i am thinking right now.')
print('But do not worry. I am going to let you to enter 6 names and i will choose one of them.')
print('After that you have to answer the correct name that i am thinking right now')
print('Please enter the first name in letters')
secretnames[0].append(input())
print('Please enter the second name in letters')
secretnames[1].append(input())
print('Please enter the third name in letters')
secretnames[2].append(input())
print('Please enter the fourth name in letters')
secretnames[3].append(input())
print('Please enter the fifth name in letters')
secretnames[4].append(input())
print('Please enter the sixth name in letters')
secretnames[5].append(input())
print('Alright ' + name + ' . Thank you for entering the names.')
secret = random.choice(secretnames)
for i in range(10):
print('Guess a name.')
ans = str(input())
if ans == secret:
print('Good job. You give the correct answer in ' + str(i) + ' guesses.')
elif ans != secret:
print('Wrong Answer.')
這是第一次,你需要輸入任何你喜歡的名字,然後程序會從你進入那些決定一個名字,然後你必須輸入正確的姓名,他是片段現在想着。我輸入了所有的名字,但都沒有工作。片段無法正常工作
想想對象你」重新使用:'secret'是一個單元素列表,它不會等於輸入字符串。 – jonrsharpe