0
for i in n:
    sn = str(input("What is the student's name? "))
    sg = eval(input("What is the student's grade? "))

如果您这样做,那么您将如何保留用户的输入并存储它?

4

1 回答 1

0

你可以使用一个数组:

names = []
grades = []
for i in n:
    sn = str(input("What is the student's name? "))
    names.append(sn)
    sg = eval(input("What is the student's grade? "))
    grades.append(sg)
于 2012-10-02T18:25:28.267 回答