I have the following code:
import math
class h:
vektor = [0,0]
rel_chyba = 0
def __init__(self, hodnota, chyba):
self.vektor[0] = hodnota
self.vektor[1] = chyba
self.rel_chyba = chyba*1.0/hodnota
def __rmul__(self, hod2):
return h(hod2.vektor[0]*self.vektor[0], math.sqrt(self.rel_chyba*self.rel_chyba+hod2.rel_chyba*hod2.rel_chyba))
v = h(12,1)
print v.vektor[1]
t = h(25,2)
print v.vektor[1]
My problem is, that v.vektor[1] prints 1 for the first time and 2 for the second time. All the attributes of the object v are assigned the values of the attributes from t.
How can I create two different objects? Thanks for your answers