Font size
WorksheetsList Review Quiz
Total questions: 14
Worksheet time: 7mins
What operations cannot be performed on a list?
Update
Modify
Divide
Sort
How do you add an element to the end of a list named my_list?
(a)
What is the output of the following code?
3
6
12
What is the purpose of a "for" loop?
To define a function
To iterate over a sequence
To use the range function
To use conditional statement
You would like to add 7 to the end of this list:
nums = [9, 1, 6, 3, 5, 8, 2]
Select ALL commands that will accomplish this.
nums.append(7)
nums.extend([7])
nums.insert(7, 7)
nums.pop(7)
How do you add the number 5 to the end of a list named `numbers`?
numbers.add(5)
numbers.append(5)
numbers.insert(5)
numbers.extend(5)
Loops in programming start counting from ?
0
1
Any number
Which of the following is the correct way to create the following list of names: 'Tom', 'Jerry', 'Tweetie', 'Sylvester'?
What list would be created by this command: list(range(2, 14, 4))?
[2, 6, 10]
[4, 8, 10, 12, 14]
[4, 8, 10, 12]
[2, 6, 10, 14]
Which of these commands would create a list of numbers starting at 0 and up to (but not including) 9?
list(9)
list(range(9))
list(range(10))
list(range([0, 9]))
Which of the following is the correct way to create an empty list?
empty_list = [0]
empty_list = {}
empty_list = None
empty_list = []
Which of the following lines of code will correctly sort mylist?
mylist.sorted()
sort(mylist)
mylist.sort
mylist.sort()
What will be the output of the following code: print(len([1, 2, 3, 4]))?
3
4
5
None
