76 245
Assignments Done
Successfully Done
In May 2019

Answer to Question #47441 in Python for Sunny

Question #47441
I have a question in Python programming
Here is a small snippet of the program

class MyBool(int):
def __repr__(self):
return 'MyBool.' + ['False', 'True']

When I run this code I get the following
>>> MyBool(1)
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
File "C:\Python34\lib\idlelib\rpc.py", line 614, in displayhook
text = repr(value)
File "C:/Users/Saurabh/Desktop/MyBool.py", line 3, in __repr__
return 'MyBool.' + ['False', 'True']
TypeError: Can't convert 'list' object to str implicitly

How Can I change the return output to string ?
Expert's answer

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions