0
why am I getting an error?
class Person: def __init__(self, name, age): self.name = name self.age = age def eatndrink(self): print('eat food and drink water', self.name, self.age) class Car: def hascar(self): print('I have a beautiful car') print(self.age) p = Person('aa', 56) Car.hascar() If the run the above code I am getting typeerror - Car.hascar() missing 1 required positional argument:self
3 Answers
0
Jay Matthews In this code I am trying to access the Person class instance variables inside Car class
0
Jay Matthews May I know the why am I getting the type error in the code