Dictionary Iteration: Printing Key, Value Pairs (#38722)

* Dictionary Iteration: Printing Key, Value Pairs

* Apply suggestions from code review

Co-authored-by: Eric Leung <eric@erictleung.com>

Co-authored-by: Beau Carnes <beaucarnes@gmail.com>
Co-authored-by: Eric Leung <eric@erictleung.com>
pull/38526/head
Ray Johnson 2020-05-13 20:28:46 -05:00 committed by Mrugesh Mohapatra
parent 35ede1fc49
commit e21439d7e8
1 changed files with 5 additions and 5 deletions

View File

@ -14,13 +14,13 @@ videoId: XzosGWLafrY
```yml
question:
text: Question
text: How would you iterate over and print the keys and values of a dictionary named "user"?
answers:
- one
- two
- three
- '<pre>for key in user.items():<br> print(key)</pre>'
- '<pre>for key, value in user.all():<br> print(key, value)<br> print(value)'
- '<pre>for key, value in user.items():<br> print(key, value)</pre>'
- '<pre>for key, value in user<br> print(key, value)</pre>'
solution: 3
```
</section>