Allow Saving of assignments
This commit is contained in:
parent
0338d91684
commit
a6db2d9430
1 changed files with 34 additions and 16 deletions
50
main.py
50
main.py
|
@ -1,28 +1,46 @@
|
||||||
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
|
||||||
|
|
||||||
|
if len(keys) > 1:
|
||||||
|
key = fp.menu(keys, "Please select an assignment to grade")
|
||||||
fp.clear()
|
fp.clear()
|
||||||
|
if key:
|
||||||
while not False:
|
answerKey = key
|
||||||
answer = fp.replitInput(
|
answerCount = len(key)
|
||||||
f"Please input the answer to question #{answerCount + 1}, empty answer to submit answer key"
|
else:
|
||||||
).upper()
|
while not False:
|
||||||
if not answer:
|
answer = fp.replitInput(
|
||||||
break
|
f"Please input the answer to question #{answerCount + 1}, empty answer to submit answer key"
|
||||||
if len(answer) > 1:
|
).upper()
|
||||||
multi = fp.replitInput("Is this multiple answers? (Y|n)")
|
if not answer:
|
||||||
if multi.upper() != "N":
|
break
|
||||||
for i in range(len(answer)):
|
if len(answer) > 1:
|
||||||
answerCount += 1
|
multi = fp.replitInput("Is this multiple answers? (Y|n)")
|
||||||
answerKey.append(answer[i])
|
if multi.upper() != "N":
|
||||||
continue
|
for i in range(len(answer)):
|
||||||
answerCount += 1
|
answerCount += 1
|
||||||
answerKey.append(answer)
|
answerKey.append(answer[i])
|
||||||
|
continue
|
||||||
|
answerCount += 1
|
||||||
|
answerKey.append(answer)
|
||||||
|
name = fp.replitInput("Please enter the name of this assignment")
|
||||||
|
keys[name] = answerKey
|
||||||
|
with open("assignments.py", "w") as file:
|
||||||
|
file.write(f"keys = {keys}")
|
||||||
|
|
||||||
fp.clear()
|
fp.clear()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue