How to avoid `can't multiply sequence by non-int of type 'float'`

Hi,
I got two dict self.theta & self.beta and a fp value eta, when I tried to modify it as below:

self.theta[0]=self.theta[0]-eta*self.beta[0]

It returned TypeError: can't multiply sequence by non-int of type 'float'.
If I put it into a for loop of the dict, it worked, but I cannot separately manipulate with a single key such as [0] above, have to finish the modification in the for loop in this case.

for key in self.theta.items(): 
      self.theta[key[0]]=self.theta[key[0]]-eta*self.dE_dTheta[key[0]]

I wonder is it possible to directly modify the self.theta[0] without getting the error? The numpy array seems like a workaround but I need to change the code a lot so I am thinking about solely torch methods.

This doesn’t seem to be a PyTorch-specific issue, but seems to be raised by Python directly.
Could you post the content of both dicts and explain the use case a bit?

Thank you for your reply, you are totally right and I solve it with some help from stackoverflow. Specifically, I messed up the index of self.theta which makes me do eta * [] so it raised the error.
Sorry for the ‘unrelated’ post.
(https://stackoverflow.com/questions/63302668/why-does-items-work-for-the-multiplication-between-sequence-and-float#)