Run ❯
Get your
own Python
server
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
my_list = [None, None, None, None, None, None, None, None, None, None] def hash_function(value): sum_of_chars = 0 for char in value: sum_of_chars += ord(char) return sum_of_chars % 10 def add(name): index = hash_function(name) my_list[index] = name def contains(name): index = hash_function(name) return my_list[index] == name add('Bob') add('Pete') add('Jones') add('Lisa') add('Siri') print("'Pete' is in the Hash Table:", contains('Pete'))
'Pete' is in the Hash Table: True