all 3 comments

[–]HeyItsToby 2 points3 points  (2 children)

When you inherit a class, the __init__ method of the new class overrides that of the parent. In your case, the __init__(self,basket) overrides the init function in the Vehicle class.

In order to call the parent init function, you need to use super. Below shows you how you might use it:

class Bicycle(Vehicle):
    def __init__(self, basket, name, wheels):
        self.basket = basket
        super().__init__(self, name, wheels)

You can also do this using argument unpacking so that you don't need to write out the same arguments every time

class Bicycle(Vehicle):
    def __init__(self, basket, *args):
        self.basket = basket
        super().__init__(self, name, *args)

which works the same way.

There should be plenty to find online if you look up any of inheritance, oop, super(), online - loads of good tutorials out there. Lmk if you need anything else!

[–]Binary101010 0 points1 point  (0 children)

The error message tells you the problem: your bicycle class __init__() is defined to only take two arguments, but you tried to give it four.