From 71fa3e70a52c90f0f00cc5ee588ca7e923e9541e Mon Sep 17 00:00:00 2001 From: Arina Dohadailo Date: Tue, 27 Oct 2026 13:23:22 +0000 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20u7/hash=5Ftable.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- u7/hash_table.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 u7/hash_table.py diff --git a/u7/hash_table.py b/u7/hash_table.py new file mode 100644 index 0000000..9e09f7c --- /dev/null +++ b/u7/hash_table.py @@ -0,0 +1,16 @@ +class HashTable: + _DELETED = object() + + def __init__(self, capacity=10): + if type(capacity) != int: + raise TypeError("Capacity must be an integer") + if capacity <= 0: + raise ValueError("Capacity must be positive") + + self._capacity = capacity + self._table = [None] * capacity + self._size = 0 + + @property + def capacity(self): + return self._capacity \ No newline at end of file