【发布时间】:2013-10-28 00:25:24
【问题描述】:
我正在做一个任务,我必须针对不同的主题进行测验。这是我目前的代码。
print("Hello and welcome to Shahaad's quiz!") #Introduction
name = input("What is your name? ")
print("Alright", name,", these will be today's topics:")
print("a) Video Games")
print("b) Soccer")
print("c) Geography")
choice = input("Which topic would you like to begin with?")
if choice == 'video games' or choice == 'Video Games' or choice == 'Video games' or choice == 'a)':
print("You picked Video Games.")
print("Question number one:")
print("What is the most popular FPS (First Person Shooter) game?")
print("a) Call of Duty")
print("b) Battlefield")
print("c) Grand Theft Auto 5")
print("d) Counter Strike")
answer = input("Your answer:")
guessesTaken = 0
if answer == 'Call Of Duty' or answer == 'Call of duty' or answer == 'Call of duty' or answer == 'a)' or answer == 'call of duty':
print("You are correct!")
else:
guessesTaken = guessesTaken + 1
print("Incorrect!")
print("You have", guessesTaken, "guess left!")
我正在努力做到这一点,以便如果他们回答错误,他们将有另一个机会回答这个问题。现在一旦他们弄错了,他们就不能再打字了。谢谢!
【问题讨论】: