Associative array/Merging: Difference between revisions

Content added Content deleted
(added Python solution)
Line 56: Line 56:
<pre>{"color": "red", "name": "Rocket Skates", "price": 15.25, "year": 1974}</pre>
<pre>{"color": "red", "name": "Rocket Skates", "price": 15.25, "year": 1974}</pre>


=={header|Python}}==
=={{header|Python}}==
As of Python 3.5, this can be solved with the dictionary unpacking operator.
As of Python 3.5, this can be solved with the dictionary unpacking operator.
<lang Python>base = {"name":"Rocket Skates", "price":12.75, "color":"yellow"}
<lang Python>base = {"name":"Rocket Skates", "price":12.75, "color":"yellow"}