+ 1

why did it show error???

The code: class Vehicle: """Base class for all the vehicles""" def ___init__(self, name, manufacturer, color): self.name = name self.manufacturer = manufacturer self.color = color def drive(self): print("Driving", self.manufacturer, self.name) def turn(self, direction): print("Turning", self.name, "to", direction) def brake(self): print(self.name, "is stopping!") if __name__ == "__main__": v1 = Vehicle("a", "b", "c") v2 = Vehicle("a", "b", "c") v3 = Vehicle("a", "b", "c") v1.drive() v2.drive() v3.drive() v1.turn("left") v2.turn("right") v1.brake() v2.brake() v3.brake() The output: Traceback (most recent call last): File "C:/Users/Swapnil/Desktop/Python/chapter 6/p1.py", line 20, in <module> v1 = Vehicle("a", "b", "c") TypeError: Vehicle() takes no arguments

10th Sep 2020, 1:01 PM
Swapnil
Swapnil - avatar
2 Réponses
+ 1
~ swim ~ thank you It was typing mistake 😅😅😅😅😅
13th Sep 2020, 8:44 PM
Swapnil
Swapnil - avatar