-
Notifications
You must be signed in to change notification settings - Fork 0
/
task.html
14 lines (14 loc) · 1.83 KB
/
task.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<h2>Flower taxonomy</h2>
<html>
<head></head>
<body>
<p>Ronald is filling up his dataset with new data to classify species of <em>Iris </em>flowers better. Define a function <code class="java">add_iris()</code> to help him a bit.</p>
<p>The parameters for each new sample include <code class="java">id_n</code> identifying a flower, <code class="java">species</code>, <code class="java">petal_length</code> and <code class="java">petal_width</code>. Apart from <code class="java">species</code>, which should be a string, all the mentioned parameters will have a numerical value: either an integer (<code class="java">id_n</code>) or a float (<code class="java">petal_length</code>, <code class="java">petal_width</code>). Collect other <strong>keyword</strong> arguments in case new features appear.</p>
<p>Your function should add a new key-value pair into an existing dictionary called <code class="java">iris</code>. Predictably, <code class="java">id_n</code> will serve as a key, and its value should be a dictionary with the rest of specified parameters.</p>
<p>For example, after calling the function for the first time <code class="java">add_iris(0, 'Iris versicolor', 4.0, 1.3, petal_hue='pale lilac')</code> the dictionary <code class="java">iris</code> will look like this <code class="java">{0: {'species': 'Iris versicolor', 'petal_length': 4.0, 'petal_width': 1.3, 'petal_hue': 'pale lilac'}}</code>. Pay attention to the last pair that represents a new feature.</p>
</body>
</html><br><br><font color="gray">Memory limit: 256 MB</font><br><font color="gray">Time limit: 15 seconds</font><br><br>
<b>Caution</b><br><br>
You may see errors in your code or execution results due to missing context. Don’t worry about it, just write the solution and press Check.
<br><br>
<a href="https://hyperskill.org/learn/step/9544">Show topic summary</a>