2020-04-06 18:49:56 +00:00
|
|
|
---
|
|
|
|
id: 5e7b9f0a0b6c005b0e76f069
|
2020-04-22 04:37:02 +00:00
|
|
|
title: Dictionaries and Loops
|
2020-04-06 18:49:56 +00:00
|
|
|
challengeType: 11
|
|
|
|
videoId: EEmekKiKG70
|
2021-01-13 02:31:00 +00:00
|
|
|
dashedName: dictionaries-and-loops
|
2020-04-06 18:49:56 +00:00
|
|
|
---
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --description--
|
|
|
|
|
2020-04-06 18:49:56 +00:00
|
|
|
More resources:
|
2020-11-27 18:02:05 +00: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 18:49:56 +00:00
|
|
|
```
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
## --answers--
|
|
|
|
|
2021-01-21 18:12:42 +00:00
|
|
|
<pre>annie 42
|
|
|
|
jan 100</pre>
|
2020-11-27 18:02:05 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
|
2021-01-21 18:12:42 +00:00
|
|
|
<pre>chuck 1
|
2020-11-27 18:02:05 +00:00
|
|
|
annie 42
|
2021-01-21 18:12:42 +00:00
|
|
|
jan 100</pre>
|
2020-11-27 18:02:05 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
|
2021-01-21 18:12:42 +00:00
|
|
|
<pre>chuck 1</pre>
|
2020-11-27 18:02:05 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
|
2021-01-21 18:12:42 +00:00
|
|
|
<pre>[Error]</pre>
|
2020-11-27 18:02:05 +00:00
|
|
|
|
|
|
|
## --video-solution--
|
|
|
|
|
|
|
|
1
|