+ 1

Why " return "statement is not used in LINE 7

https://code.sololearn.com/c7jZ7aIFLyET/?ref=app

25th Mar 2018, 12:20 PM
Sanjay Leo
Sanjay Leo - avatar
2 odpowiedzi
+ 4
There is no return, because you never have to print its result, you just edit the list. The "return" on line 5 also doesn't have to be there. So the class can be: ... def add(self,a): self.n.append(a) def remove(self,b): self.n.remove(b) def dis(self): return self.n ... And the "return" on line 9 must be there, because when you run "dis" function, you want to print its result. If there will be no return it will just result in None.
25th Mar 2018, 12:33 PM
Tim Thuma
Tim Thuma - avatar
+ 1
Oh.. thank u.. There is not need for return in line 5 as well Now I m clear.. thanks
25th Mar 2018, 12:54 PM
Sanjay Leo
Sanjay Leo - avatar