Blossom Project Q25

I am doing Computer Science Path of Codecademy.
I came across a project called Blossom. I was able to successfully complete it. But there is an open-ended problem there.

Now use our app! Look up a flower’s meaning using blossom.retrieve('daisy') . Try printing it out!

Does it work? Next, try looking up another flower. Is the flower you’re looking for missing? How would you add it in?

So my question is how can I add a functionality where I can add a missing key, value pair in the retrieve function.
I used iter() and try, except. But in the except, it shows EOF error when I take input for value.

Let me share my function code:
def retrieve(self, key):

hash_code = self.hash(key)

i = self.compress(hash_code)

list_at_index = self.array[i]

iterable = iter(list_at_index)


  while True: 

      node = next(iterable)

      if node != None:

        if node[0] == key:

          return node[1]

  print("Key is missing")
  value = input("Enter value to the key : ")