+ 3

why I get ( TypeError: '>' not supported between instances of 'Monom' and 'Monom')

class Monom: def __init__(self ,coef, exp): if not ininstance(exp, coef) or exp<0: raise ValueError ('Illegal exponent') self.coef= coef self.exp=exp def __repr__(self): res= str(self.coef) + 'x^'+ str(self.exp) if self.coef ==0: res='0' if self.coef==1: res= 'x^' + str(self.exp) if self.exp==0: res= str(self.coef ) if self.exp== 1: res= str(self.coef) +'x' reter res def __It__(self,other) : if self.exp> other.exp: return True elif self.exp== other.exp: if self.coef>other.coef: return True return False .... well everything is going alright if i put( m1= Monom(4,6) i get m1= 4x^6) if m2=Monom(5,3) and I put (m2> m1) i get TypeError.. thanks,

30th Sep 2018, 10:51 AM
sama baluom
sama baluom - avatar
9 Respostas
+ 2
Are you using __It__ (capital i) instead of __lt__ (lowercase L)?
30th Sep 2018, 11:16 AM
Anna
Anna - avatar
+ 3
Can you give the code? I can't read it 😂😂😂
30th Sep 2018, 11:00 AM
ShortCode
+ 1
Change it đŸ€“
30th Sep 2018, 11:19 AM
Anna
Anna - avatar
+ 1
oww thank you Anna! i tried to use l , I didn't notived that
30th Sep 2018, 11:19 AM
sama baluom
sama baluom - avatar
+ 1
thanks it work nowâ˜ș
30th Sep 2018, 11:20 AM
sama baluom
sama baluom - avatar
+ 1
You're welcome
30th Sep 2018, 11:20 AM
Anna
Anna - avatar
0
hmm you mean this? , I git error too in this app ,(other kind of error 😅)it work in laptop though but if i try use '>' between two Monoms it don't work
30th Sep 2018, 11:17 AM
sama baluom
sama baluom - avatar
30th Sep 2018, 11:17 AM
sama baluom
sama baluom - avatar
0
ya
30th Sep 2018, 11:18 AM
sama baluom
sama baluom - avatar