# Super Simple Hash Function
sentence_1 = "The old lighthouse keeper, Phineas, watched the relentless sweep of the beam cut through the fog, a familiar, hypnotic rhythm that had governed his life for thirty years. Outside, the gulls cried a mournful chorus against the steady roar of the Atlantic, their sound muffled by the thick, salty air. He remembered a story from his childhood, about a ship that had mistaken a particularly bright star for its light and met disaster on the jagged reefs below. Tonight, the sea was a canvas of inky black, disturbed only by whitecaps that seemed to grin menacingly in the sparse illumination, a perfect, lonely night for a man who preferred the company of waves and silence."
sentence_2 = "My name is Zhach, and I like Becky."
sentence_3 = "My name is Zach, and I like Becky."
sentence_4 = "Lz mbme ht Ybch, bnc J kike Cfbkx."
def hash_func(input):
result = 0
for letter in input:
# "ord" Turns any letters or symbol into a number.
result += ord(letter)
# Just for fun, let's multiply the number by a prime and
# take the remainder after dividing by 100,000.
return (result*39827)%int(100000)
print(hash_func(sentence_1))
print(hash_func(sentence_2))
print(hash_func(sentence_3))
print(hash_func(sentence_4))
Click Run or press shift + ENTER to run code