diff --git a/u7/hash_table.py b/u7/hash_table.py index 5904eb6..c5ca737 100644 --- a/u7/hash_table.py +++ b/u7/hash_table.py @@ -1,10 +1,9 @@ - class HashTable: def __init__(self, capacity=10): """Vytvor prázdnu tabuľku s kladnou celočíselnou kapacitou.""" if type(capacity) is not int: - raise TypeError("Is not integer") + raise TypeError("It's not integer") if capacity <= 0: raise ValueError("Capacity > 0") @@ -22,7 +21,7 @@ class HashTable: def hash(self, key): """Vráť polynomiálny hash kľúča modulo aktuálna kapacita.""" if not isinstance(key, str): - raise TypeError("Key - not string!") + raise TypeError("Key must be a string") h = 0 for znak in key: @@ -59,7 +58,9 @@ class HashTable: raise TypeError("Key must be a string") def __len__(self): - pass + return self._size def __iter__(self): - pass + for item in self._table: + if item is not None and item is not self._DELETED: + yield item[0]