Dict Methods and Functions (STSCI 4060)

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/10

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 12:51 PM on 9/15/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

11 Terms

1
New cards

dict.keys()

Returns a list of dictionary keys of dict_keys type

2
New cards

dict.values()

Returns a list of dictionary values of dict_values type

3
New cards

dict.get(key, default)

For a given key, returns the value of the key or default if key not in dictionary

4
New cards

dict.items()

Returns a list of dict's tuple pairs (key, value)

5
New cards

dict.update(dict2)

Adds dictionary dict2's key:value pairs to dict

6
New cards

dict.fromkeys(seq, value)

Create a new dictionary with keys from seq (can be a list, tuple, set, string (seperates characters), range) and values set to value

7
New cards

dict.setdefault(key, default)

Similar to get(), but will set dict[key]=default if key is not already in dict

8
New cards

dict.copy()

Returns a copy of dictionary dict (the content of the dictionary is not copied by value, but just creates a new reference)

9
New cards

dict.clear

Removes all elements of dictionary dict

10
New cards

len(dict)

Returns the total length (or size) of the dictionary

11
New cards

str(dict)

Produces a printable string representation of a dictionary