solutions

Introduction to Dictionaries

Write a function that receives a number X and creates a dictionary containing X elements. The elements will be the word "banana"*X and the number. If the number passed to the function is less than 1, return an empty dictionary.

banana_dict(2)
{
  "banana": 1,
  "bananabanana": 2
}
banana_dict(4)
{
  "banana": 1,
  "bananabanana": 2,
  "bananabananabanana": 3,
  "bananabananabananabanana": 4
}

Test Cases

tests

[]