The below, python dictionary (my_fruits_dic) holds fruits and their price. my_fruits_dic = { "Fruit": "Price", "apple": 6.44, "banana": 0.77, "orange": 3.44, }...


The below, python dictionary (my_fruits_dic) holds fruits and their price.



my_fruits_dic = {


    "Fruit": "Price",


    "apple": 6.44,


    "banana": 0.77,


    "orange": 3.44,


}



---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



(1)  Add a new item "berries" with the value {blackberry: 1.24, blueberry: 3.14}.



Print myDic. (This new dictionary will be added without the berries key. It needs to be added as a nested dictionary under berries key).



(see screenshot to see if my code/output to this question is correct. Please provide any other of your input/ideas/knowledge.


Input code:<br>my_fruits_dic - {<br>> my_fruits_ dic - { "Fruit": "Price", "apple": 6.44, "banana": 0.77, "orange": 3.44, >>> >>> berries - { "Name": "Quantity", "blackberry": 1.24, "blueberry": 3.14, >>> >> mydic - { "thisdic" : my_fruits_dic, "berries" : berries, >>> >» print (mydic) {'thisdic': {'Fruit': 'Price', 'apple': 6.44, 'banana': 0.77, 'orange': 3.44}, 'berries': {'Name': 'Quantity', 'blackberry': 1.24, 'blueberry': 3.14}} >» I Is this method/way of doing it correct? "/>
Extracted text: Input code: my_fruits_dic - { "Fruit": "Price", "apple": 6.44, "banana": 0.77, "orange": 3.44, berries - { "Name": "Quantity", "blackberry": 1.24, "blueberry": 3.14, mydic = "thisdic" : my_fruits_dic, "berries" : berries, print (mydic) Output Answer: >> my_fruits_ dic - { "Fruit": "Price", "apple": 6.44, "banana": 0.77, "orange": 3.44, >>> >>> berries - { "Name": "Quantity", "blackberry": 1.24, "blueberry": 3.14, >>> >> mydic - { "thisdic" : my_fruits_dic, "berries" : berries, >>> >» print (mydic) {'thisdic': {'Fruit': 'Price', 'apple': 6.44, 'banana': 0.77, 'orange': 3.44}, 'berries': {'Name': 'Quantity', 'blackberry': 1.24, 'blueberry': 3.14}} >» I Is this method/way of doing it correct?
Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here