An attribute is added to an object after it is made. class Car: wheels = 4 def __init__(self, make): self.make = make c = Car("Tata") c.color = "red" print(sorted(c.__dict__), hasattr(c, "wheels"), "wheels" in c.__dict__) What does the program print?
Log in to join the discussion.
Loading…