2020-04-06 14:49:56 -04:00
|
|
|
---
|
|
|
|
id: 5e7b9f0a0b6c005b0e76f069
|
2020-04-21 23:37:02 -05:00
|
|
|
title: Dictionaries and Loops
|
2020-04-06 14:49:56 -04:00
|
|
|
challengeType: 11
|
|
|
|
videoId: EEmekKiKG70
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: dictionaries-and-loops
|
2020-04-06 14:49:56 -04:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --description--
|
|
|
|
|
2020-04-06 14:49:56 -04:00
|
|
|
More resources:
|
2020-11-27 19:02:05 +01:00
|
|
|
|
|
|
|
\- [Exercise](https://www.youtube.com/watch?v=PrhZ9qwBDD8)
|
|
|
|
|
|
|
|
# --question--
|
|
|
|
|
|
|
|
## --text--
|
|
|
|
|
|
|
|
What will the following code print?:
|
|
|
|
|
|
|
|
```python
|
|
|
|
counts = { 'chuck' : 1 , 'annie' : 42, 'jan': 100}
|
|
|
|
for key in counts:
|
|
|
|
if counts[key] > 10:
|
|
|
|
print(key, counts[key])
|
2020-04-06 14:49:56 -04:00
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
## --answers--
|
|
|
|
|
|
|
|
annie 42
|
|
|
|
|
|
|
|
jan 100
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
chuck 1
|
|
|
|
|
|
|
|
annie 42
|
|
|
|
|
|
|
|
jan 100
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
chuck 1
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
\[Error]
|
|
|
|
|
|
|
|
## --video-solution--
|
|
|
|
|
|
|
|
1
|
|
|
|
|