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

7th Oct 2020, 5:37 PM
Kelly H. Milligan
Kelly H. Milligan - avatar
6 Antworten
+ 2
little things like 4 or 5 problems. check my code https://code.sololearn.com/chg9CCe0g3sZ/?ref=app
7th Oct 2020, 6:02 PM
Slick
Slick - avatar
+ 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): ...
7th Oct 2020, 6:48 PM
Slick
Slick - avatar
+ 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
7th Oct 2020, 6:53 PM
Slick
Slick - avatar
+ 1
There we go, desc is now about and desc_ is just fine. Thanks for your help, Slick.
7th Oct 2020, 9:26 PM
Kelly H. Milligan
Kelly H. Milligan - avatar
0
Ahh, thanks! I have to put something in the class before I can call its desc.
7th Oct 2020, 6:46 PM
Kelly H. Milligan
Kelly H. Milligan - avatar
0
Oh, that could be a problem
7th Oct 2020, 6:51 PM
Kelly H. Milligan
Kelly H. Milligan - avatar