2017-10-18 2 views
0

계속 이동하기 전에 사용자가 무언가를 입력하도록하려면 무엇을 추가해야합니까? 루프에서 다시 입력아무 것도 입력하지 않은 채

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") 
+1

않음 '='대답 동안 == ''. 않음 = 입력 ("ㅋ") 상부()' – depperm

답변

-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") 
관련 문제