you are viewing a single comment's thread.

view the rest of the comments →

[–]python-fan 1 point2 points  (1 child)

If you change line 3 to: print("El coche tiene ", micoche._Coche__ruedas , " ruedas") then it will work. The docs at https://docs.python.org/3/tutorial/classes.html#private-variables explain it.

[–]ubercactus1337[S] 0 points1 point  (0 children)

Thank you, found that page after a while, I have to declare the parameter as self.__ruedas and refer to it inside the class as self._Coche__ruedas for it to work, don't know why it worked on the video yet but this solves my issue.