w3resource

Python: Access dictionary key’s element by index

Python Dictionary: Exercise - 55 with Solution

Write a Python program to access dictionary key's element by index.

Visual Presentation:

Python List: Access dictionary key’s element by index.

Sample Solution:

Python Code:

num = {'physics': 80, 'math': 90, 'chemistry': 86}
print(list(num)[0])
print(list(num)[1])
print(list(num)[2])

Sample Output:

physics
math
chemistry

Flowchart:

Flowchart: Access dictionary key’s element by index

Python Code Editor:

Previous: Write a Python program to get the depth of a dictionary.
Next: Write a Python program to convert a given dictionary into a list of lists.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/python-exercises/list/python-data-type-list-exercise-65.php