我需要一个二维列表来存储有关学生及其成绩的信息。
当我运行我的程序时,我只得到一份数字列表,但我需要为每个学生单独列出。谁能帮我?
这是我到目前为止所做的:
COLS= int(input("number of students to enter "))
ROWS= int(input("number of grades per student "))
def main():
number =[]
for c in range(COLS):
student =(input("enter student ID number "))
number.append(student)
for r in range (ROWS):
grades =(input("Enter grade for module: "))
number.append(grades)
print(number)
my result is
number of students to enter 2
number of grades per student 4
enter student ID number 1234
Enter grade for module: 55
Enter grade for module: 66
Enter grade for module: 43
Enter grade for module: 33
enter student ID number 2345
Enter grade for module: 34
Enter grade for module: 56
Enter grade for module: 78
Enter grade for module: 99
['1234', '55', '66', '43', '33', '2345', '34', '56', '78', '99']
>>>