Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 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š