+ 3
Can someone explain this??
class Solo(): def __str__(self): return 'sololearn' a='sololearn' b=Solo() print(a==b) #outputs False print(a) #outputs sololearn print(b) #outpots sololearn #then why a==b is False ,please explain
10 Respostas
+ 11
a != b because they are of different classes. So no matter their content, a == b will be False:
https://code.sololearn.com/cNLuQ9PEOeiO/?ref=app
+ 1
Madhava == checks the reference of the objects
+ 1
Thanks lisa
+ 1
Thanks Atul
+ 1
Nak chepava Rađ
0
Both are different classes
0
Thanks ra yeshđ
0
Good boy đ
0
You should call the function to get the value from it then only it will compare dude đ
0
Thanks Manishđ