write a function that computes a hask key for a string. the hash key is the average of the position of each letter in the alphabet divided by the size of the table. you can use the charposition() defined in the previous exercise in your calculation, this correct implementation was provided for you in this exercises.

Respuesta :

a function that determines a string's hask key. The average position of each letter in the alphabet divided by the size of the table yields the hash key.

def char_position(char):

   alphabet = list("abcdefghijklmnopqrstuvwxyz")

   return alphabet.index(char)

def hash_key(string):

   total = 0

   for char in string.lower():

       total += char_position(char)

   return total / len(string)

Learn more about hash here

https://brainly.com/question/13451676

#SPJ4

ACCESS MORE
EDU ACCESS