Question: PYTHON A set is a container that stores a unique set of values True False When you use a collection of unique items, _____ sets

PYTHON

A set is a container that stores a unique set of values

True

False

"When you use a collection of unique items, _____"

sets are more efficient that lists

lists are more efficient than sets

The ___ of two sets produces a new set that contains the elements of both sets.

union

subset

intersection

complement

A list is a sequence of elements each of which has a position ordered by an index.

True

False

Lists are ____.

mutable

immutable

"If x is a list, then y = x ____."

makes two separate copies of the lists

means both x and y refer to the same list

A list contains 12 elements. So ____.

the range of indexes is 1 to 12

the range of indexes is 0 to 12

the range of indexes is 0 to 11

the range of indexes is 0 to 13

True or False: To copy a list you can use this. list2 = list1 [:]

Which statement creates a duplicate copy of a dictionary?

menu2 = dict(menu)

menu2 = copy(menu)

menu2 = duplicate(menu)

menu2 = menu

The _________ method adds an element to the end of a list.

addToEnd

addLast

atEnd

append

What is the result of this? min(["Roland", "Kent", "Sue", "Amy"])

Invalid Error Type

Roland

Amy

Sue

True or False: "The items is a dictionary are stored in sequential order that can be accessed by index, like with a list."

"Given the following what are the contents of the list fullNames?

firstNames = ["Joe", "Jim", "Betsy", "Shelly"] lastNames = ["Jones", "Patel", "Hicks", "Fisher"] fullNames = firstNames + LastNames

["Joe", "Jones", "Jim", "Patel", "Betsy", "Hicks", "Shelly", "Fisher"]

["Joe Jones", "Jim Patel", "Betsy Hicks", "Shelly Fisher"]

["Joe", "Jim", "Betsy", "Shelly", "Jones", "Patel", "Hicks", "Fisher"]

["Joe", "Jim", "Betsy", "Shelly"]

What is displayed when it is executed?

x = {} x["Hello"] = [4, 5] x["Hello"].append("World") print(x["Hello"])

Hello

HelloWorld

[4, 5]

[4, 5, "World"]

What is displayed when this runs?

values = [1, 2, 3, 4, 5] moreValues = values moreValues[3] = 6 print(values)

[1, 2, 3, 4, 5]

[1, 2, 6, 4, 5]

[1, 2, 3, 6, 5]

[1, 2, 3, 4, 5, 6]

If the key "Sun" doesn't exist, then

food = menu ["Sun"]

returns -1

raises an exception

returns an empty set

returns None

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!