﻿ Python: Access dictionary key’s element by index - 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.

Sample Solution:-

Python Code:

``````num = {'physics': 80, 'math': 90, 'chemistry': 86}
print(list(num))
print(list(num))
print(list(num))
```
```

Sample Output:

```physics
math
chemistry
```

Pictorial Presentation: Flowchart: ## Visualize Python code execution:

The following tool visualize what the computer is doing step-by-step as it executes the said program:

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

﻿

## Python: Tips of the Day

Returns the symmetric difference between two lists, after applying the provided function to each list element of both:

Example:

```def tips_symmetric_difference_by(p, q, fn):
_p, _q = set(map(fn, p)), set(map(fn, q))
return [item for item in p if fn(item) not in _q] + [item for item in q if fn(item) not in _p]
from math import floor
print(tips_symmetric_difference_by([4.2, 2.4], [4.6, 6.8],floor))
```

Output:

```[2.4, 6.8]
```

We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook