0
[Solved] Why won't class print the desc?
I have a class that won't print the desc, even though I have one written. What did I do wrong? https://code.sololearn.com/c1Zji7h1Ge5p/?ref=app
6 Respuestas
+ 2
little things like 4 or 5 problems. check my code
https://code.sololearn.com/chg9CCe0g3sZ/?ref=app
+ 1
Also change the name of the method.
Saw how the underscore was added?
Try not to name things the same, for instance:
def print_desc(self): ...
+ 1
it was, delete the underscores and see for yourself. Thats also a handy little trick, if you like the variable name, but it has namespace clash, just throw an underscore before or after. gets confusing though, so try to stay on distiguishable variable names
+ 1
There we go, desc is now about and desc_ is just fine. Thanks for your help, Slick.
0
Ahh, thanks! I have to put something in the class before I can call its desc.
0
Oh, that could be a problem