일부 학생에게 간단한 퀴즈를 만들려고 노력하고 있는데, 잘못된 문자를 입력하면 반복되는 질문을하고 싶지만, 어떻게해야하는지 잘 모르겠습니다. 누군가 도울 수 있습니까?조건부 파이썬을 사용한 원시 입력
player score=[]
x2=raw_input("Question 3" '\n'
"How many tests have you taken in past 24 hours?" '\n'
"A) 0" '\n'
"B) 1" '\n'
"C) 2" '\n'
"D) 3" '\n'
"E) Too many to count"'\n')
if x2=="A":
player_score.append('0')
elif x2=="B":
player_score.append('1')
elif x2=="C":
player_score.append('2')
elif x2=="D":
player_score.append('3')
elif x2=="E":
player_score.append('4')
else:
print "you typed the wrong letter"
print player_score
먼저 '숙제에 대한 도움'이라고 표시 하시겠습니까? 둘째, 루프하려는 경우 루프를 추가해야합니다. – user590028
@ user590028 : 더 이상 숙제 상태로 질문에 태그를 추가하지 않습니다 ([여기] (http://meta.stackexchange.com/questions/147100/the-homework-tag-is-now-official-deprecated) 참조). – DSM
왜 player_score는 문자열/정수가 아닌 목록입니까? –