Multiple answers at once support
This commit is contained in:
parent
21dc1ad073
commit
0338d91684
1 changed files with 22 additions and 5 deletions
27
main.py
27
main.py
|
@ -14,6 +14,13 @@ while not False:
|
|||
).upper()
|
||||
if not answer:
|
||||
break
|
||||
if len(answer) > 1:
|
||||
multi = fp.replitInput("Is this multiple answers? (Y|n)")
|
||||
if multi.upper() != "N":
|
||||
for i in range(len(answer)):
|
||||
answerCount += 1
|
||||
answerKey.append(answer[i])
|
||||
continue
|
||||
answerCount += 1
|
||||
answerKey.append(answer)
|
||||
|
||||
|
@ -22,15 +29,25 @@ fp.clear()
|
|||
while 1:
|
||||
right = 0
|
||||
try:
|
||||
queue = []
|
||||
for i in range(answerCount):
|
||||
answer = fp.replitInput(
|
||||
f"Please input the student's answer to question {i + 1}. ^C at any time to show results immediately."
|
||||
).upper()
|
||||
answer = ""
|
||||
if not queue:
|
||||
answer = fp.replitInput(
|
||||
f"Please input the student's answer to question {i + 1}. ^C at any time to show results immediately."
|
||||
).upper()
|
||||
else:
|
||||
answer = queue.pop(0)
|
||||
if len(answer) > 1:
|
||||
multi = fp.replitInput("Is this multiple answers? (Y|n)")
|
||||
if multi.upper() != "N":
|
||||
queue = list(answer)
|
||||
answer = queue.pop(0)
|
||||
if answer == answerKey[i]:
|
||||
right += 1
|
||||
print(" That is correct")
|
||||
print(f" Answer {i + 1} is correct")
|
||||
else:
|
||||
print(" That is incorrect")
|
||||
print(f" Answer {i + 1} is incorrect")
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
print(
|
||||
|
|
Loading…
Reference in a new issue