Python Programming Unit 2 Module 2

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

The .append() method adds an item to the beginning of a list.

False

The .insert() method overwrites (replaces) the list item at the selected index.

False

Choose the item that best completes the sentence: "A Python list..."

can add items to the end of the list using the .append() method.

Choose the item that best completes the following sentence: "A Python list..."

can contain both strings and numbers together as list items.

Which best describes a valid Python use of the following days List?

days.insert(1, "Wednesday")

Which best describes the valid Python use of the following days List?

All of the above

The .pop() method both returns and deletes an item from a list.

true

Which best describes the result of the following code? days = [12, 9, "Monday", 1] days.remove("Friday")

Error, because "Friday" was not found and can't be removed

Which code places another "2" integer to the end of the following list? numbers = [1, 1, 2]

numbers.append(2)

Which code overwrites (replaces) the "0" with a "5" in the following numbers list? numbers = [1, 1, 0]

numbers[2] = 5

Which is valid Python code that will print "Green", given the following code? colors = ["Red", "Blue", "Green", "Yellow"]

print(colors[2])

Which best describes the result of the following code? numbers = [2, 3, 2] total = 0 while numbers: total += numbers.pop()

numbers is an empty list and total is 7

The first item in a Python List is located at index 0 (zero).

True

Which code is the best use of Python that deletes the "5" in the following numbers list? numbers = [7, 1, 5, 8, 0]

del numbers[2]

Which is a valid way to initialize a Python list?

scores = [11, 8, 0, 24, 31, 12, 19]

Choose the item that best completes the following sentence: "After using an insert on a Python list..."

the length of the list increases by 1.


संबंधित स्टडी सेट्स

Bacterial STDs, Sexually Transmitted Disease

View Set

DHO-Chapter 18:3 Completing Job and Application Forms

View Set

Chapter 5: Topic 4: The Nominating and Governance Committee | p. 168-177

View Set