0
Please does anyone has any idea why this code outputs False? It's a sololearn challenge quiz.
class Solo(): def __str__(self): return "sololearn" a = "sololearn" b = Solo() print (a == b)
2 Réponses
+ 1
This little adaption to your code might explain.
class Solo():
def __str__(self):
return "sololearn"
a = "sololearn"
b = Solo()
print (a == b)
print(type(a))
print(type(b))
As you can see, the outputs types are different, which creates a false result
+ 2
Rik Wittkopp, Woah thank you. Just realized that now. That's indeed a smart way of checking..