:mrgreen: hi im am tryingto create a dimensional analysis thing going on and so far i have this
def mult(self,other):
tempTuple1=list()
tempTuple2=list()
i=0
for unit,value in other.expr:
for unit2,value2 in self.expr:
if unit2 == unit:
tempTuple1.append((unit, value+value2))
#self.expr[i]=tempTuple1
## for unit2,value2 in self.expr:
## for unit,value in other.expr:
## if unit2 != unit:
## tempTuple1.append((unit2,value2))
print tempTuple1
and my output is so far like this:
>>> t = dimensions([('j',2),('km',1), ('f',5)])
>>> w = dimensions([('j',2),('f',1)])
>>> w.mult(t)
[('j', 4), ('f', 6)] need to append km1.... what am i doing wrong anyone? thanks for your help