+ 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 odpowiedzi
+ 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😊