0

TypeError: __init__() takes 3 positional arguments but 4 were given. How to fix this error?

https://code.sololearn.com/cRi11cpb83oi/?ref=app

3rd Jul 2020, 2:59 PM
Atul
Atul - avatar
7 Answers
+ 1
just needed to fix the super call. compare with your fixed code https://code.sololearn.com/c1n8HPZpcU2j/?ref=app
3rd Jul 2020, 3:43 PM
Slick
Slick - avatar
+ 2
Please share your code first. We don't know what are you talking about?? You have shared your exception only (error)......................
3rd Jul 2020, 3:03 PM
Arctic Fox
Arctic Fox - avatar
+ 2
class Vehicle(): def __init__(self,name,battery=70): self.name = name self.battery = battery def battery_life(self): print("It has "+ str(self.battery) + " horsepower") def name_1(self): print(self.name + " is my favourite car") my_car = Vehicle ("corvette c7") my_car.battery_life() my_car.name_1() class Bullet(Vehicle): def __init__(self,name,battery,color): super().__init__(name,battery) self.color = 350 def color1(self): print("The color is " + str(self.color)) my_bullet = Bullet("Thunderbird", "Matte Black" ,350) my_bullet.name_1() my_bullet.battery_life() my_bullet.color1()
3rd Jul 2020, 3:46 PM
JaScript
JaScript - avatar
+ 2
Slick Ja Play Def greet() print("thanku for the help!") greet() 😊
3rd Jul 2020, 4:19 PM
Atul
Atul - avatar
3rd Jul 2020, 3:12 PM
Atul
Atul - avatar
0
No problem Atul
3rd Jul 2020, 4:30 PM
JaScript
JaScript - avatar
0
Ja Play it still have a problem that when you runs the code the output of last 2 lines are only the first 2 instances in my_bullet = Bullet
3rd Jul 2020, 4:39 PM
Atul
Atul - avatar