1/19
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Why should a beginner avoid writing customers = customers.sort() in the exercise?
sort() changes the existing list rather than returning a new sorted list to assign
Given departments = ['Accounting', 'Finance', 'Marketing', 'ISA'], what does print('Economics' in departments) display?
False
Which statement best matches the distinction taught in the exercise?
Lists can be changed; tuples normally cannot be changed.
Which statement in the exercise creates a separate shallow copy of original?
another_list = copy.copy(original)
Given inventory = ['Laptop', 'Mouse', 'Keyboard'], what remains after del inventory[0]?
['Mouse', 'Keyboard']
Given sales = [2400, 1200, 3100, 1800, 1500], what is the list after sales.sort()?
[1200, 1500, 1800, 2400, 3100]
Which statement removes the value 'Keyboard' from inventory, regardless of its current index?
inventory.remove('Keyboard')
Given departments = ['Accounting', 'Finance', 'Marketing', 'ISA'], what does departments.index('Marketing') return?
2
Which statement sorts the list sales from highest to lowest?
sales.sort(reverse=True)
Given departments = ['Accounting', 'Finance', 'Marketing', 'ISA'], what does print(len(departments)) display?
4
Given: cities = ['Atlanta', 'Savannah', 'Austin', 'Dallas', 'Seattle']. What does print(cities[1:4]) display?
['Savannah', 'Austin', 'Dallas']
Consider original = ['Laptop', 'Mouse', 'Keyboard'], another_list = original, another_list[0] = 'Tablet'. What is the first item in original afterward?
Tablet
Consider products = ['Laptop', 'Mouse', 'Keyboard'], for product in products: print(product). What does the variable product represent during each pass through the loop?
One current item from the products list
Consider inventory = ['Laptop', 'Mouse', 'Keyboard'], inventory[1] = 'Wireless Mouse', print(inventory[1]). What is displayed?
Wireless Mouse
Given sales = [1200, 1500, 1100, 1800, 2100], which statement displays only the first three values?
print(sales[:3])
Given: products = ['Laptop', 'Mouse', 'Keyboard', 'Monitor']. Which expression displays 'Keyboard'?
products[-2]
Given sales = [ ['Atlanta', 12000], ['Savannah', 8500], ['Austin', 15000] ]. What does print(sales[1][0]) display?
Savannah
Suppose inventory = ['Laptop', 'Mouse', 'Keyboard']. Which statement adds 'Monitor' to the END of the list?
inventory.append('Monitor')
Given inventory = ['Laptop', 'Mouse', 'Keyboard'], what is the result after inventory.insert(1, 'Tablet')?
['Laptop', 'Tablet', 'Mouse', 'Keyboard']
What is printed by this code? sales = [1200, 1500, 1100]; total = 0; for amount in sales: total = total + amount; print(total)
1200\n2700\n3800