python class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

python class

when I run this code in python 3.8, I got True but when I run the same code in python 3.6, I got False.🤣🤣 _______________________________________________ class my_class(): x = 0 def __str__(self): self.x+=1 return str(self.x) a = my_class() print(str(a) == "1" and str(a)=="2") ______________________________________

31st May 2021, 8:10 PM
Alaa Aldeen Shammr
Alaa Aldeen Shammr - avatar
3 Answers
+ 1
on sololearn python 3.8.6, output is True as expected ^^
1st Jun 2021, 12:06 AM
visph
visph - avatar
0
well, I guess that's not real python wich run your code, but an emulator... however, they alert about known limitations, and possible bugs ^^ I advise you to contact them and submit the unexpected behavior you're facing, as they advises themselves in the 'known limitations' links...
1st Jun 2021, 12:36 AM
visph
visph - avatar