W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
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 add('Bob') print(my_list)