Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.image text in transcribed

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, } int (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': 8.77, orange": 3.44}, "berries': {"Name" : 'Quantity', 'blackberry': 1.24, blueberry': 3.14}} >>> 0 Is this method/way of doing it correct

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

Discuss the Hawthorne experiments in detail

Answered: 1 week ago

Question

Explain the characteristics of a good system of control

Answered: 1 week ago

Question

State the importance of control

Answered: 1 week ago

Question

What are the functions of top management?

Answered: 1 week ago