![]() |
dictionary question - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Homework (https://python-forum.io/forum-9.html) +--- Thread: dictionary question (/thread-33143.html) |
dictionary question - stereokim123 - Apr-01-2021 Hi I'm currently learning the basic python course, dictionary. Item = {‘Apple’ : 10, ‘Banna’ : {‘Apple’ : 5, ‘Banna’ : 20}} here is the code that is given. 1. The question is about finding the Apple value and explain the reason for the result. 2. What code should I write in order to use 'Apple' that is in the 'Banna' value. Thanks.! RE: dictionary question - BashBedlam - Apr-01-2021 The Apple that you want is the first element in the Banana dictionary not the first element in the Item dictionary. Sooo.... Item = {'Apple' : 10, 'Banana' : {'Apple' : 5, 'Banana' : 20}} print (Item ['Banana']['Apple']) RE: dictionary question - stereokim123 - Apr-01-2021 (Apr-01-2021, 09:17 PM)BashBedlam Wrote: The Apple that you want is the first element in the Banana dictionary not the first element in the Item dictionary. Sooo.... you saved ma life bro thx |