Nov-14-2018, 03:36 AM
Please use python and output tags when posting code and results. I put them in for you this time. Here are instructions for doing it yourself next time.
Look at your definition of Pet, specifically the get_name method. You defined two parameters: self and name. The self parameter is provided automatically for instances of the class, but you have to provide name. If you don't, the function fails. You don't use the name parameter, so you should probably just remove it. You're going to have the same problem with your other getters.
BTW, this is Python, not Java. You never almost never use getters and setters in Python. They slow things down, make your code harder to understand, and don't actually do anything. If you really need that sort of security (as in, self.y must change whenever self.x changes) you use properties. But generally you just don't bother.
Look at your definition of Pet, specifically the get_name method. You defined two parameters: self and name. The self parameter is provided automatically for instances of the class, but you have to provide name. If you don't, the function fails. You don't use the name parameter, so you should probably just remove it. You're going to have the same problem with your other getters.
BTW, this is Python, not Java. You never almost never use getters and setters in Python. They slow things down, make your code harder to understand, and don't actually do anything. If you really need that sort of security (as in, self.y must change whenever self.x changes) you use properties. But generally you just don't bother.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures