didnt run On my Python 2.7 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

didnt run On my Python 2.7

class SpecialString: def __init__(self, cont): self.cont = cont def __truediv__(self, other): line = "=" * len(other.cont) return "\n".join([self.cont, line, other.cont]) spam = SpecialString("spam") hello = SpecialString("Hello world!") print(spam / hello) error at my PYTHON IDLE: Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> print spam/hello TypeError: unsupported operand type(s) for /: 'instance' and 'instance'

3rd Nov 2016, 7:26 AM
Adhiraj Majumdar
Adhiraj Majumdar - avatar
1 Answer
0
What are you intending to do in the print statement?
3rd Nov 2016, 11:35 AM
Harry Pearson
Harry Pearson - avatar