Hi Alan. You are correct with the indentation.
class Cat: name = "" kind = "cat" color = "" value = 100.00 def description(self): desc_str = "%s is a %s %s cat worth R%.2f." % (self.name, self.color, self.kind, self.value) return desc_str The above code is the question, which I am not allowed to edit. So just to test the lecturer's code, I run the command print(Cat.description()) This returns an error. >>>> TypeError: description() missing 1 required positional argument: 'self' To me, this is flawed. I should be able to get a fault less response from that command. Any other code I append to it by inheriting the class Cat, will still have that similar error. Now, I've added the following code to inherit the class Cat: description. class Cat1(Cat): name = "Whiskers" kind = "Burmese cat" color = "grey" value = 3000.00 When I run this command, I still receive the same error. print(Cat1.description()) Please assist where possible. Regards Vusa On Wed, Feb 8, 2017 at 11:06 AM, Alan Gauld via Tutor <tutor@python.org> wrote: > On 08/02/17 07:11, Vusa Moyo wrote: > > I have a suspicion my lecturer's question is flawed, so I'd like to pose > it > > to you guys to confirm my suspicions. > > I think your interpretation of the question is flawed. > See Peter's reply for why. > > However another point is.... > > > class Cat: > > name = "" > > kind = "cat" > > color = "" > > value = 100.00 > > def description(self): > > > > desc_str = "%s is a %s %s cat worth R%.2f." % (self.name, self.color, > > self.kind, self.value) > > Python is sensitive to indentation. This line needs > to be indented inside the def statement. (This may > be a mail formatting issue but since the rest of > your code looks OK I doubt it) > > > > -- > Alan G > Author of the Learn to Program web site > http://www.alan-g.me.uk/ > http://www.amazon.com/author/alan_gauld > Follow my photo-blog on Flickr at: > http://www.flickr.com/photos/alangauldphotos > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor