请看下面的代码片段,我问了下面的问题
class SAMPLES:
x = np.zeros(10)
def __init__(self, k, value):
self.x[k] = value
a = SAMPLES(0, 9)
b = SAMPLES(0, 10)
print(a.x[0])
print(b.x[0])
Run Code Online (Sandbox Code Playgroud)
输出:
10
10
Run Code Online (Sandbox Code Playgroud)
但输出必须是:
9
10
Run Code Online (Sandbox Code Playgroud)
我应该如何解决这个问题?
python ×1