Dictionary related questions

Asked 2 weeks ago, Updated 2 weeks ago, 1 views

In the table below, save the ice cream name as a key value and the list as a dictionary value. The dictionary is named inventory.

Name price inventory
Melona 30020
Bibibig 4003
Jaws Bar 250 100

That's what I said

inventory={"Merona":(300,20), "Bibibig":(400,3), "Jawsbar":(250,100)}

inventory={"Merona":[300,20], "Bibibig":[400,3], "Jawsbar":[250,100]}

I want to know if it is right to express it with () or [] or it doesn't matter.


2022-09-20 15:38

1 Answers

(Price, stock) It says to save the list as the value of the dictionary, right?

inventory={"Melona":[300,20], "Bibibig":[400,3], "Jawsbar":[250,100]}

2022-09-20 15:38

If you have any answers or tips

© 2022 pinfo. All rights reserved.