Multiple answers at once support

This commit is contained in:
Firepup Sixfifty 2024-08-27 09:13:54 -05:00
parent 21dc1ad073
commit 0338d91684
Signed by: Firepup650
SSH key fingerprint: SHA256:cb8sEJwc0kQJ6/nMUhscWRe35itf0NFMdSKl3v4qt48

21
main.py
View file

@ -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 = ""
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(