Allow exiting stude answers early
This commit is contained in:
parent
1000ffaca6
commit
7a227dc1f4
1 changed files with 12 additions and 9 deletions
21
main.py
21
main.py
|
@ -21,15 +21,18 @@ fp.clear()
|
||||||
|
|
||||||
while 1:
|
while 1:
|
||||||
right = 0
|
right = 0
|
||||||
for i in range(answerCount):
|
try:
|
||||||
answer = fp.replitInput(
|
for i in range(answerCount):
|
||||||
f"Please input the student's answer to question {i + 1}."
|
answer = fp.replitInput(
|
||||||
)
|
f"Please input the student's answer to question {i + 1}. ^C at any time to show results immediately."
|
||||||
if answer == answerKey[i]:
|
)
|
||||||
right += 1
|
if answer == answerKey[i]:
|
||||||
print(" That is correct")
|
right += 1
|
||||||
else:
|
print(" That is correct")
|
||||||
print(" That is incorrect")
|
else:
|
||||||
|
print(" That is incorrect")
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
pass
|
||||||
print(
|
print(
|
||||||
f"\nThe student got {right}/{answerCount} correct, with approximately an {round((right/answerCount) * 100, 2)}%.\n"
|
f"\nThe student got {right}/{answerCount} correct, with approximately an {round((right/answerCount) * 100, 2)}%.\n"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue