Day 064 - Project 64 : Jobs in a school

If you have any questions, comments or issues with this project please post them here!

I’m actually having issues once I get to the Inheritance slide with the part about polly = bird(“Green”) and the self.color = color.

1 Like

Could you explain these issues?

class bird(animal):

  def __init__(self):
    self.name = "Bird"
    self.species = "Avian"
    self.sound = "Tweet"
    self.color = color # Only applies to the bird sub class


polly = bird("Green") # Sets polly's colour to 'Green'
polly.talk()
print(polly.color) # Prints polly's color

This is the code given in the example (the part I’m having issues with)

This is the error I’m getting: TypeError: init() takes 1 positional argument but 2 were given

class bird(animal):

  def __init__(self, color):
    self.name = "Bird"
    self.species = "Avian"
    self.sound = "Tweet"
    self.color = color # Only applies to the bird sub class


polly = bird("Green") # Sets polly's colour to 'Green'
polly.talk()
print(polly.color) # Prints polly's color

Wow, thanks. That makes a sense.

you’re welcome, it’s easy to make typos, especially when learning :smiley:

It doesn’t explain it in the lesson though. What I pasted here was from the lesson portion of it. I do understand though that some of the learning is probably intended to be figuring things out.

mhm, yeah I can see that being a problem, you should perhaps ping DavidAtReplit and make a support ticket for confusing lessons

Will definitely keep that in mind. Thanks a bunch for the help with this.

You’re welcome! Have a nice day

yeah and in the “fix my code” the answer is not working, the talk() is missing and the color attribute is not handled right. so @DavidAtReplit should maybe review his answer and correct it :slight_smile: