Inactive Tutor answered 02/08/21
my_berry_dict = {
"berry":"ver",
"blackberry": 1.24,
"blueberry": 3.14
}
my_fruits_dic = {
"Fruit": "Price",
"apple": 6.44,
"banana": 0.77,
"orange": 3.44,
"berries" : my_berry_dict
}
print(my_fruits_dic)
Jessie M.
asked 02/08/21The 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).
Inactive Tutor answered 02/08/21
my_berry_dict = {
"berry":"ver",
"blackberry": 1.24,
"blueberry": 3.14
}
my_fruits_dic = {
"Fruit": "Price",
"apple": 6.44,
"banana": 0.77,
"orange": 3.44,
"berries" : my_berry_dict
}
print(my_fruits_dic)
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Jessie M.
great job! 5 star!02/08/21