class_number = prompt_int_big("Before your score is saved ,are you in class 1, 2 or 3? Press the matching number")
filename = (str(class_number) + "txt")
if any(name in s for s in filename):
[name].insert(score), insert(level_of_difficulty)
else:
with open(filename, 'a') as f:
f.write("\n" + str(name) + " scored " + str(score) + " on difficulty level " + str(level_of_difficulty) + "\n")
with open(filename) as f:
lines = [line for line in f if line.strip()]
lines.sort()
I am trying to code a quiz and at the moment it saves the students last score however I would like to change it so that it saves the last three. I've been made aware that I need to change the current 2d array I am using into a 3d one but I do not know how to do that.
Any help
Aucun commentaire:
Enregistrer un commentaire