Last active
March 8, 2022 03:10
-
-
Save tomplex/37e3bc63f2a6fc60c14bedd4ce8793d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List | |
class House: | |
def __init__(self, rooms: List[Room]): | |
self.rooms = rooms | |
def __len__(self): | |
return len(self.rooms) | |
def __getitem__(self, item): | |
return self.rooms[item] | |
def area(self) -> int: | |
return sum(room.area() for room in self.rooms) | |
house = House([]) | |
assert len(house) == 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment