Blossom project HashMap issue

Hello friendly pythonistas

I’ve worked through the project, following instructions and the guide video as closely as I can and I’m getting None as the result of the print statement at the very end there. I’m guessing its an indentation error, but I can’t find it. What’ve I done wrong?!?!

thanks

from linked_list import Node, LinkedList

from blossom_lib import flower_definitions



class HashMap:

  def __init__(self, size):

    self.array_size = size

    self.array = [LinkedList() for i in range(self.array_size)]



  def hash(self, key):

    return sum(key.encode())



  def compress(self, hash_code):

    return hash_code % self.array_size



  def assign(self, key, value):

    array_index = self.compress(self.hash(key))

    payload = Node([value, key])

    list_at_array = self.array[array_index]

    for item in list_at_array:

      if key == item[0]:

        item[1] = value

        return

      list_at_array.insert(payload)

      return



  def retrieve(self, key):

    array_index = self.compress(self.hash(key))

    list_at_index = self.array[array_index]

    for item in list_at_index:

      if key == item[0]:

        return item[1]

      return None





blossom = HashMap(len(flower_definitions))



for flower in flower_definitions:

  blossom.assign(flower[0], flower[1])



print(blossom.retrieve('daisy'))

where did the print get its value from? if you look backwards from where you found the bad result then eventually you’ll reach the point where you lost track of your value

‘daisy’ comes from the imported ‘flower_definitions’ on line 2. Its corresponding value is supposed to be ‘innocence.’

I mean, go look.
Your program is a series of events that should be happening. If you observe what those events are while comparing to the events you’re wanting to happen, then you’ll find the difference.