A club uses the following Python code to prepare a label and update its member list. After all four statements execute, which values do label and members contain?


Python
label = "oak"
label.upper()
members = ["Ari", "Bo"]
members.append("Cy")
Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A student is choosing Python types for a small inventory program. Match each type to the description that correctly combines its contents with its mutability.

Match each term
A.

Mutable collection associating keys with values that can be updated

B.

Mutable collection of distinct elements that supports adding and removing members

C.

Mutable ordered collection whose entries can be replaced by index

D.

Immutable sequence of characters whose individual positions cannot be overwritten

Dictionary

Set

String

List

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A registration program stores confirmed participant numbers in a Python set. After this code executes, how many participant numbers remain in confirmed? Give an exact whole-number count, with no decimal places.


Python
confirmed = {14, 18, 23}
backup = confirmed
backup.add(18)
backup.add(27)
confirmed.remove(14)
backup = backup | {31, 35}
backup.remove(23)

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

Extra Practice