我一直在自学IGCSE计算机科学(可以编程),但我与数组的问题
我的书以这个代码为例
import array
NoStudents = int(30)
Studentmarktest = array.array ('i',range(NoStudents+1))
for i in range(0,30):
Studentmarktest[Counter] = int(input("Enter students score"))
print (Studentmarktest)
但是这个例子返回:NameError: name 'Counter' is not defined
看看你的代码
您使用
i
作为循环的索引变量。但在循环中,您使用的是Counter
。你只需改变这一点:相关问题 更多 >
编程相关推荐