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()
|
).upper()
|
||||||
if not answer:
|
if not answer:
|
||||||
break
|
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
|
answerCount += 1
|
||||||
answerKey.append(answer)
|
answerKey.append(answer)
|
||||||
|
|
||||||
|
@ -22,15 +29,25 @@ fp.clear()
|
||||||
while 1:
|
while 1:
|
||||||
right = 0
|
right = 0
|
||||||
try:
|
try:
|
||||||
|
queue = []
|
||||||
for i in range(answerCount):
|
for i in range(answerCount):
|
||||||
answer = fp.replitInput(
|
answer = ""
|
||||||
f"Please input the student's answer to question {i + 1}. ^C at any time to show results immediately."
|
if not queue:
|
||||||
).upper()
|
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]:
|
if answer == answerKey[i]:
|
||||||
right += 1
|
right += 1
|
||||||
print(" That is correct")
|
print(f" Answer {i + 1} is correct")
|
||||||
else:
|
else:
|
||||||
print(" That is incorrect")
|
print(f" Answer {i + 1} is incorrect")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
print(
|
print(
|
||||||
|
|
Loading…
Reference in a new issue