0
for i in n:
sn = str(input("What is the student's name? "))
sg = eval(input("What is the student's grade? "))
如果你這樣做,那麼你將如何保持來自用戶的輸入並存儲它?如果您使用for循環,如何保存用戶的多個輸入?
for i in n:
sn = str(input("What is the student's name? "))
sg = eval(input("What is the student's grade? "))
如果你這樣做,那麼你將如何保持來自用戶的輸入並存儲它?如果您使用for循環,如何保存用戶的多個輸入?
你可以使用一個數組:
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)