1c. Dictionary Flashcards

1
Q

dictionary method (x3+2 default)

A
.keys
.values
.items  => return tuples
.get(key, default value)
.setdefault(key, some value) => only assign if there is no key
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

nice printing of dictionary

A

pair \n and in order

import pprint
pprint.pprint(mydict)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly