I have the following piece of code:
p1 = np.array([[[[[[[[[[0.]*2]*2]*2]*2]*2]*2]*2]*2]*2]*2)
s = [0]*10
#
# Do something with s
#
p1[s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9]] += 1
Is there a smarter way of:
- Creating p1 without all those brackets, and
- Access the components of p1 with a string or a list?
I have in mind something like:
p1[s] += 1
or:
p1[*s] += 1
For example, what if instead of 10 indices I wanted N indices?