Flower taxonomy

Report a typo

Ronald is filling up his dataset with new data to classify species of Iris flowers better. Define a function add_iris() to help him a bit.

The parameters for each new sample include 4 obligatory parameters:

  • id_n
  • species
  • petal_length
  • petal_width

There may also be some additional features. Collect keyword arguments to get them.

Your function should add key-value pairs into an existing dictionary called iris. Predictably, id_n will serve as a key, and its value should be a dictionary with the rest of the specified parameters.

Please, don't print or return anything: you only need to update the dictionary iris.

For example, after calling the function for the first time add_iris(0, 'Iris versicolor', 4.0, 1.3, petal_hue='pale lilac') the dictionary iris will look like this {0: {'species': 'Iris versicolor', 'petal_length': 4.0, 'petal_width': 1.3, 'petal_hue': 'pale lilac'}}. Pay attention to the last pair that represents a new feature.

Write a program in Python 3
iris = {}


def add_iris():
pass
___

Create a free account to access the full topic