Compare commits
No commits in common. "1120649fd02a1a2b3e259ed62e8e4922d130628e" and "21dc1ad073b1b817bcbe5eabece4952bd9399c90" have entirely different histories.
1120649fd0
...
21dc1ad073
2 changed files with 15 additions and 72 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
assignments.py
|
|
||||||
__pycache__/**
|
|
85
main.py
85
main.py
|
@ -1,91 +1,36 @@
|
||||||
import firepup650 as fp
|
import firepup650 as fp
|
||||||
|
|
||||||
keys = {"Create new assignment": False}
|
|
||||||
|
|
||||||
try:
|
|
||||||
from assignments import keys
|
|
||||||
except:
|
|
||||||
with open("assignments.py", "w") as file:
|
|
||||||
file.write(f"keys = {keys}")
|
|
||||||
|
|
||||||
fp.replitCursor = fp.bcolors.REPLIT + "> " + fp.bcolors.RESET
|
fp.replitCursor = fp.bcolors.REPLIT + "> " + fp.bcolors.RESET
|
||||||
|
|
||||||
answerKey = []
|
answerKey = []
|
||||||
answer = "0"
|
answer = "0"
|
||||||
answerCount = 0
|
answerCount = 0
|
||||||
key = False
|
|
||||||
validAnswers = []
|
|
||||||
|
|
||||||
if len(keys) > 1:
|
|
||||||
key = fp.menu(keys, "Please select an assignment to grade")
|
|
||||||
fp.clear()
|
|
||||||
if key:
|
|
||||||
answerKey = key["key"]
|
|
||||||
answerCount = len(key["key"])
|
|
||||||
validAnswers = key["valid"]
|
|
||||||
else:
|
|
||||||
while not False:
|
|
||||||
answer = fp.replitInput(
|
|
||||||
f"Please input the answer to question #{answerCount + 1}, empty answer to submit answer key"
|
|
||||||
).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)
|
|
||||||
name = fp.replitInput("Please enter the name of this assignment")
|
|
||||||
validAnswers = list(
|
|
||||||
fp.replitInput("Please enter the valid answers to this assignment").upper()
|
|
||||||
)
|
|
||||||
keys[name] = {"key": answerKey, "valid": validAnswers}
|
|
||||||
with open("assignments.py", "w") as file:
|
|
||||||
file.write(f"keys = {keys}")
|
|
||||||
|
|
||||||
fp.clear()
|
fp.clear()
|
||||||
|
|
||||||
tDigits = 1
|
while not False:
|
||||||
tmp = answerCount
|
answer = fp.replitInput(
|
||||||
while tmp > 9:
|
f"Please input the answer to question #{answerCount + 1}, empty answer to submit answer key"
|
||||||
tmp = tmp / 10
|
).upper()
|
||||||
tDigits += 1
|
if not answer:
|
||||||
|
break
|
||||||
|
answerCount += 1
|
||||||
|
answerKey.append(answer)
|
||||||
|
|
||||||
|
fp.clear()
|
||||||
|
|
||||||
while 1:
|
while 1:
|
||||||
right = 0
|
right = 0
|
||||||
try:
|
try:
|
||||||
queue = []
|
|
||||||
for i in range(answerCount):
|
for i in range(answerCount):
|
||||||
answer = ""
|
answer = fp.replitInput(
|
||||||
if not queue:
|
f"Please input the student's answer to question {i + 1}. ^C at any time to show results immediately."
|
||||||
answer = fp.replitInput(
|
).upper()
|
||||||
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)
|
|
||||||
aDigits = 0
|
|
||||||
tmp = i + 1
|
|
||||||
while tmp > 9:
|
|
||||||
aDigits += 1
|
|
||||||
tmp = tmp / 10
|
|
||||||
digits = tDigits - aDigits
|
|
||||||
space = " " * digits
|
|
||||||
if answer == answerKey[i]:
|
if answer == answerKey[i]:
|
||||||
right += 1
|
right += 1
|
||||||
print(f"++ Answer {space}{i + 1} is correct")
|
print(" That is correct")
|
||||||
elif answer in validAnswers:
|
|
||||||
print(f"-- Answer {space}{i + 1} is incorrect")
|
|
||||||
else:
|
else:
|
||||||
print(f"?? Answer {space}{i + 1} is N/A")
|
print(" That is incorrect")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
print(
|
print(
|
||||||
|
|
Loading…
Reference in a new issue