DEV Community

Cover image for Dictionary in Python - Continuation
datatoinfinity
datatoinfinity

Posted on

Dictionary in Python - Continuation

Nested Dictionary:

In dictionary you can have tuple, list, and dictionary also. Let see how it work.

coffee_menu={
    "Coffee":{"Espresso":"Bold shot","Latte":"Creamy delight","Cappuccino":"Frothy classic"},
    "Flavour":{"Mocha":"Choco-Coffee","ColdBrew":"Smooth Chill","AMericano":"Espresso + Water"}
}
print(coffee_menu)

Now how to access it:

print(coffee_menu1["Coffee"])

And if I want to access some value from it:

print(coffee_menu1["Coffee"]["Espresso"])

There are more advance concept of dictionary I want you to explore and please let me know It will help you and me also.

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments. Some comments have been hidden by the post's author - find out more