Exam 4: Introducing the Python Collections: Lists, Dictionaries, Tuples, and Statistics

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Case Study 2: >>> changeList = [1, 2, "buckle my shoe", 3, 4, "shut the door"] 2. >>> changeList 3. [1, 2, 'buckle my shoe', 3, 4, 'shut the door'] 4. >>> changeList[2] = "the sky is blue" 5. >>> changeList 6. ?????? 7. >>> name = "Monte" 8. >>> name[2] = "x" 9. ?????? -Refer to the session in the accompanying Case Study 2. What will be the output on line 6?

(Multiple Choice)
4.8/5
(38)

What will be the output based on the following lines of code? >>> myList = [3, "cat", 6.5, 2] >>> myList

(Multiple Choice)
4.8/5
(36)

Case Study 1: 1. >>> m 2. >>> ?????? 3. print(answer) Output: A B E A D B B A C E -Refer to the session in the accompanying Case Study 1. What program statements appear on line 2 to create the output listed in the case study?

(Multiple Choice)
4.8/5
(31)

Case Study 3: >>> ages = {'David':45, 'Brenda':46} >>> ages {'David': 45, 'Brenda': 46} >>> -Refer to the session in the accompanying Case Study 3. What will be the output after the following statement? >>> ages['David']

(Multiple Choice)
4.8/5
(42)

The ____ list function removes and returns the last item in a list.

(Multiple Choice)
4.9/5
(32)

What method is used to retrieve the value from a dictionary associated with a given key?

(Multiple Choice)
4.7/5
(44)

An interesting question arises when we consider what would happen if we did not have a built-in function to return the maximum value in the list. We could conceivably construct our own getMax function by iterating through the items in the list and keeping track of the largest value that we encounter. Provide an implementation of such a function.

(Essay)
4.9/5
(31)

Describe the use of the split method for lists and provide an example of its use.

(Essay)
4.9/5
(39)

What is the membership operator for lists?

(Multiple Choice)
4.9/5
(36)

Strings are mutable collections of data in which individual items within the string cannot be changed.

(True/False)
4.9/5
(33)

The values() method returns a dict_values object that behaves much like a list of the values in a dictionary.

(True/False)
4.8/5
(33)

What statement is used to remove an entry from a dictionary based on a given key?

(Multiple Choice)
4.7/5
(33)

Python provides the ____ function to create a list from a range or string.

(Multiple Choice)
4.8/5
(43)
Showing 21 - 33 of 33
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)