QUESTION IMAGE
Question
which data structure is an ordered collection of items that can be changed after creation?
string
list
tuple
int
question 2
1 pts
which data structure is an unordered collection of unique items?
string
list
tuple
set
question 3
1 pts
which of the following is not a valid way to create a list?
my_list =
my_list = list()
my_list = (1, 2, 3)
my_list = 1, \hello\, 3.14
Brief Explanations
- Question 1: A list is an ordered collection of items that can be changed (mutable) after creation. Strings are ordered but immutable. Tuples are ordered and immutable. Int is a single - value data type, not a collection.
- Question 2: A set is an unordered collection of unique items. Strings are ordered. Lists are ordered. Tuples are ordered.
- Question 3:
my_list=(1,2,3)creates a tuple, not a list.my_list = []creates an empty list.my_list = list()also creates an empty list.my_list=[1,"hello",3.14]creates a list with mixed - type elements.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
- Question 1: List
- Question 2: Set
- Question 3:
my_list=(1,2,3)