jskfan
asked on
Python Class classname (Object)
Python Class classname (Object)
I have the codes below if I declare the class Car(object) or just class Car, I get the same result. I am not sure what the keyword (Object) is for.
Thanks
class Car:
wheels = 4
def __init__(self, make, model):
self.make = make
self.model = model
mustang = Car('Ford', 'Mustang')
print (mustang.wheels)
# 4
print (Car.wheels)
# 4
I have the codes below if I declare the class Car(object) or just class Car, I get the same result. I am not sure what the keyword (Object) is for.
Thanks
class Car:
wheels = 4
def __init__(self, make, model):
self.make = make
self.model = model
mustang = Car('Ford', 'Mustang')
print (mustang.wheels)
# 4
print (Car.wheels)
# 4
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER