Solutions will be available when this assignment is resolved, or after a few failing attempts.

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": 1,
  "bananabanana": 2
  "banana": 1,
  "bananabanana": 2,
  "bananabananabanana": 3,
  "bananabananabananabanana": 4

Test Cases

test dictionary with zero elements - Run Test

def test_dictionary_with_zero_elements():
    assert banana_dict(0) == {}

test dictionary with one element - Run Test

def test_dictionary_with_one_element():
    assert banana_dict(1) == {'banana': 1}

test dictionary with three elements - Run Test

def test_dictionary_with_three_elements():
    assert banana_dict(3) == {
        'banana': 1,
        'bananabanana': 2,
        'bananabananabanana': 3