在继续之前,我需要添加什么来强制用户输入内容。
print()
print("Question 2")
print("What is the currency of Spain?")
print()
print("A Euro")
print("B Dollar")
print("C Yen")
print("D Krona")
answer = input("What is your choice: ").upper()
while answer is none #keep asking
if answer == "A":
print("Correct!")
score = score + 1
else:
print("Sorry, the correct answer was A")
答案 0 :(得分:-1)
在循环中再次提示输入:
print()
print("Question 2")
print("What is the currency of Spain?")
print()
print("A Euro")
print("B Dollar")
print("C Yen")
print("D Krona")
answer = input("What is your choice: ").upper()
while answer == "":
answer = input("What is your choice: ").upper()
if answer == "A":
print("Correct!")
score = score + 1
correct = True
else:
print("Sorry, the correct answer was A")