from typing import List class Room: def __init__(self, rank: int, name: str = ""): self.name = name self.rank = rank def __str__(self): return f"{self.name}: {self.rank}" def __repr__(self): return str(self.rank) limits = [{i, 2 * i} for i in range(0, 26)] @staticmethod def get_rank_list(rooms: List) -> List: return [room.rank for room in rooms] @staticmethod def show_rooms(rooms: List) -> List: return [str(room) for room in rooms] @staticmethod def ad_least_twice(rooms: List) -> bool: for room in rooms: for divider_room in rooms: if divider_room.rank / room.rank >= 2.0: return True return False @staticmethod def exactly_twice(rooms: List) -> bool: ranks = Room.get_rank_list(rooms) for rank in ranks: if 2 * rank in ranks: return True return False @staticmethod def constrained_exactly_twice(rooms: List) -> bool: ranks = {room.rank for room in rooms} for limit in Room.limits: if limit.issubset(ranks): return True return False