Data Types 1
Data Types 2
Data Types 3
Data Types 4
Data Types 5
100

What type of data structure is the following:

names = {"Jeremy", "Leo", "Dylan"}

Set

100

What type of data structure is the following:

grades = [98, 100, 82]

List

100

What type of data structure is the following:

classroom = {

    "Trevor": 100,

    "Jeremy": 89,

    "Hannah": 98,

}

Dictionary

100

What type of data structure is the following:

student_info = ("Elizabeth", 13, "8th grade")

Tuple

100

What symbols do we use for dictionaries?

{ : }

200

What brackets do we use for lists?

[ ]

200

What brackets do we use for tuples?

( )

200

What brackets do we use for sets?

{ }

200

What is the following?

distance = [5, 7, 20, 11, 18]

List

200

What is the following?

classmates = {

"Billy" : 8,

"Vance" : 12

}

Dictionary

300

What is wrong with the following tuple?

instruments = {"clarinet", "piano", "drum", "violin"}

It needs to have parentheses

300

What is wrong with the following dictionary?

classmates = {

    "Billy" = 8,

    "Vance" = 12

}

It needs colons instead of equal signs

300

What is wrong with the following set?

colors = "orange", 14, "purple", 4, 5

It doesn't have { } curly brackets

300

Sets allow different variable types inside the same set.

True or False

True

300

What will the outcome of this code be?

desserts = ("candy", "popcorn", "soda", "cake")

print(desserts[-1])

cake

400

Debug the code. Assume that you are creating a tuple.

scores = [12, 39, 4, 70, 10]

scores = (12, 39, 4, 70, 10)

400

Tuples can be changed.

True or False

False

400

How can you access the second item in a tuple named 'instruments'?

instruments[1]

400

What is the output of the following code?

instruments = ("clarinet", "piano", "drum", "violin", "guitar") 

print(instruments[1:3])

('piano', 'drum')

400

The first item in the pairing of a dictionary is called the...

key

500

The second item in a dictionary pairing is called the...

value

500

Which data structure is ordered, changeable, and indexed in Python?

Dictionaries

500

How is data stored in a Python dictionary?

as key-value pairs
500

How do you access the value associated with the key "Vance" in the classmates dictionary?

classmates["Vance"]

500

How do you access the 3rd to last item in a list called snakes?

snakes[-3]