Completed
Lists — built-ins
Questions From This Challenge
Q1mcq1 mark
Which method adds a single element to the end of a list?
append() ✓
insert()
extend()
add()
Q2mcq1 mark
Which method removes and returns the last element of a list by default (when no index is given)?
pop() ✓
remove()
del()
discard()
Q3mcq1 mark
What does the list method count(x) return?
The number of times x appears in the list ✓
The index of x in the list
True if x is present in the list
The position where x should be inserted
Q4mcq1 mark
Which method reverses the order of elements of a list in place?
reverse() ✓
sort()
reversed()
flip()
Q5mcq1 mark
Which function would you use to find the smallest value in a list of numbers?
min() ✓
max()
sort()
index()
Q6output1 mark
What is the output of the following code?
nums = [1, 2, 3] nums.append(4) print(nums)
Correct output:
[1, 2, 3, 4]Q7output1 mark
What is the output of the following code?
nums = [10, 20, 30] nums.insert(1, 15) print(nums)
Correct output:
[10, 15, 20, 30]Q8output1 mark
What is the output of the following code?
nums = [5, 10, 15, 10] nums.remove(10) print(nums)
Correct output:
[5, 15, 10]Q9output1 mark
What is the output of the following code?
nums = [1, 2, 3, 4, 5] x = nums.pop(2) print(x, nums)
Correct output:
3 [1, 2, 4, 5]Q10output1 mark
What is the output of the following code?
nums = [1, 2, 3, 4] nums.reverse() print(nums)
Correct output:
[4, 3, 2, 1]Q11output1 mark
What is the output of the following code?
nums = [4, 1, 3, 2] nums.sort() print(nums)
Correct output:
[1, 2, 3, 4]Q12output1 mark
What is the output of the following code?
nums = [3, 7, 2, 9, 4] print(min(nums), max(nums), sum(nums))
Correct output:
2 9 25Q13output1 mark
What is the output of the following code?
nums = [1, 2, 2, 3, 2, 4] print(nums.count(2))
Correct output:
3Q14output1 mark
What is the output of the following code?
nums = [10, 20, 30, 40] print(nums.index(30))
Correct output:
2Q15output1 mark
What is the output of the following code?
nums = [5, 3, 8] nums.insert(0, 1) nums.sort() print(nums)
Correct output:
[1, 3, 5, 8]