Python: Access dictionary key’s element by index
Write a Python program to access dictionary key's element by index.
Visual Presentation:
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:
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.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics