diff --git a/lru_cache.py b/lru_cache.py index aba1c89..c9c08c6 100644 --- a/lru_cache.py +++ b/lru_cache.py @@ -4,6 +4,9 @@ class LRUCache: self.capacity = capacity self.slots = [] + def __repr__(self): + return ", ".join(map(lambda x: str(x), self.slots)) + def get(self, key: int) -> int: if key <= len(self.slots) -1: return self.slots[key] @@ -21,7 +24,10 @@ def main(): print(cache.get(0)) cache.put(0,1) - print(cache.get(0)) + print(cache) + + cache.put(1,2) + print(cache) if __name__ == "__main__": main() \ No newline at end of file