我如何更改程序,以便将此2D数组转换为3D数组?

时间:2015-12-19 10:40:10

标签: python arrays random

我正在尝试对测验进行编码,此刻它会为学生保存最后一个分数,但我想更改它以便保存最后三个。我已经意识到我需要将我正在使用的当前2d阵列更改为3d,但我不知道该怎么做。

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()

0 个答案:

没有答案