I have a suspicion my lecturer's question is flawed, so I'd like to pose it
to you guys to confirm my suspicions.

Here goes..

I've gone and created a Class Cat1(cat): <-- inherited class, but cant seem
get the code right which allows the test code to run successfully.

We have a class defined for cats. Create a new cat called cat1. Set cat1 to
be a grey Burmese cat worth 3000 with the name Whiskers.

 # define the Cat class

 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

# your code goes here


# test code

 print(cat1.description())
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to