CSE 1010 -Sets, dictionaries, and other data types

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

1/13

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No study sessions yet.

14 Terms

1
New cards

T/F Sets are ordered like lists

False. Sets are unordered elements

2
New cards
3
New cards

What does this code do?

set1.update(set2)

Adds the values from set 2 to the end of set 1

4
New cards

What does this line of code do"?

set1.intersection(set2)

It creates a new set that only holds the overlapping values between the sets

5
New cards

What does this line of code do?

set1.union(set1,set2,set3)

Creates a set of the elements that did not overlap between the sets

6
New cards

Dictionaries consist of __and _

key, values

7
New cards

What causes a runtime error?

Referencing a key that does not exist in the dictionary

8
New cards

How does .items() affect a dictionary?

It allows iteration through the entire dictionary as if it was a list. There is no longer a distinction between keys and values

9
New cards

T/F When you print a dictionary, only the keys/values print.

False. When dictionaries print, there, parenthesis are placed around the key:value pair. The colon and quotation marks for strings are printed as well

10
New cards

What is teh difference between tuples and lists?

Tuples are immutable while lists are mutable

11
New cards

Y/N Can you pass a list through a tuple? What about a set

Yes you can. If passed through a tuple, it becomes immutable.

12
New cards

.append(), .extend(), .remove(), .insert() are for what data type?

Lists

13
New cards

.add(), .remove(), .discard(), .update is for what data type?

Sets

14
New cards