【发布时间】:2012-11-05 21:02:40
【问题描述】:
所以我正在做一个测验 python 程序,我的程序似乎有一些问题。 第一次如果您想开始测验,测验将开始并像普通测验一样打印出问题,当您回答正确的问题时,我会给您积分。然而 测验结束后,您想再次进行测验,这就是问题开始的地方,当我要开始测验时,不会打印出任何问题
while True:
print('1. Take test, 2. Add Question, 3. Modify, 4. Delete, 5. Exit')
n=input('Choice: ')
counter=0
lines=q.readlines()
liness=p.read()
key=liness.split('\n')
while n not in ('1','2','3','4','5'):
print('Invalid Choice')
n=input('Choice: ')
if n=='1':
score=0
counter=0
n=0
nb=0
while True:
linez=lines[n:n+5]
for line in linez:
print(line)
b=CheckAnswer()
if b==key[nb]:
score=score+1
print('Nice')
n=n+6
nb=nb+1
counter=counter+1
print('Current Score: ',score)
if counter>=len(key):
break
谁能帮我解决这个问题?
【问题讨论】:
标签: python file list loops while-loop