← Back to Question List
Python Code Walkthrough #42
One Attribute Shared By All
📄 Code
Read carefully — what does this print?1class Dog:2 legs: int = 434 def __init__(self, name: str) -> None:5 self.name: str = name67rex: Dog = Dog("Rex")8fido: Dog = Dog("Fido")9rex.legs = 310print(rex.legs, fido.legs, Dog.legs)11Dog.legs = 512print(rex.legs, fido.legs)