how hello world is going to other. instead of spam in this code given | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how hello world is going to other. instead of spam in this code given

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)

11th Jun 2019, 11:21 AM
Raj kumar Darshanala
2 Answers
+ 2
I don't think i fully understand your question, but "spam" refers to self.cont while "Hello world!" refers to self.other
11th Jun 2019, 11:33 AM
Mo Hani
Mo Hani - avatar
0
1. As per my understanding, you are using constructor to call class and getting same output as input. 2. Please ask question properly so that we can answer it properly.
11th Jun 2019, 11:28 AM
Sachin Artani
Sachin Artani - avatar