+ 4

A question

class A: def __str__(): return "sololearn" obj = A() print("sololearn"==obj) Why the output is False?

27th May 2018, 1:47 AM
Yusuf
Yusuf - avatar
2 Answers
+ 13
class A: def __str__(self): return 'sololearn' a = A() print(str(a)=='sololearn')
31st May 2018, 2:11 PM
Mert Yazıcı
Mert Yazıcı - avatar
0
class A: def __str__(): return "sololearn" obj = A.__str__() print("sololearn"==obj)
27th May 2018, 10:07 AM
Markus Kaleton
Markus Kaleton - avatar