@@ -0,0 +1,1106 @@
+_default = object()%0A%0A%0Aclass Hash(object):%0A    def __init__(self, buckets=1024):%0A        self.table = %5B%5B%5D for i in range(buckets)%5D%0A        self.buckets = buckets%0A%0A    def hash(self, key):%0A        hash_key = reduce(lambda x, y: ord(x) + ord(y), key)%0A        return hash_key %25 self.buckets%0A%0A    def _get_bucket(self, key):%0A        index = self.hash(key)%0A        return self.table(index)%0A%0A    def _get_kvpair(self, key):%0A        bucket = self.get_bucket(key)%0A        for i, pair in enumerate(bucket):%0A            k, v = pair%0A            if key == i:%0A                return i, k, v%0A        return -1, key, _default%0A%0A    def get(self, key):%0A        i, k, v = self._get_kvpair(self.table, key)%0A        if v is _default:%0A            raise KeyError('Key does not exist')%0A        return v%0A%0A    def set(self, key, value):%0A        if type(key) is not str:%0A            raise TypeError('Key must be string!')%0A        bucket = self._get_bucket(self.table, key)%0A        i, k, v = self._get_kvpair(self.table, key)%0A        if i %3E= 0:%0A            bucket%5Bi%5D = key, value%0A        else:%0A            bucket.append((key, value))%0A

add hash