CSC EXAM 3 REVIEW WITH 100% CORRECT ANSWERS
1.What is a list: A list is a collection of items enclosed in a square Bracket
2.What data types can a list hold: Integer,String and a float
3.Lists are mutable,what does that mean?: The contents can be changed
4.Lists can be and to access elements: indexed, sliced
5.List Method:list.append(): Adds an element to the end of the list
6.The list currently is [1,2,3]
you use list.append(5)
What is the list now?: [1,2,3,5]
7.List method:list.insert(): Inserts an element at a specified position
8.The list currently is [1,2,3]
you use list.insert(1, 'a')
What is the list now?: [1,'a',2,3]
9.List method:list.extend(): Adds all elements of a list to the end
10.The list currently is [1,2,3]
1/
5
, you use list.extend(4,5)
What is the list now?: [1,2,3,4,5]
11.list method:list.remove(): Removes the first item with the specified
value
12.list method:list.pop(): Removes the element at the specified position
13.list method:list.clear(): Removes all elements from the list
14.The list currently is [a,1,a]
you use list.remove('a')
What is the list now?: [1,'a']
15.The list currently is [1,2,3]
you use list.pop(1)
What is the list now?: [1,3]
16.The list currently is [1,2,3]
you use list.clear
2/
5
1.What is a list: A list is a collection of items enclosed in a square Bracket
2.What data types can a list hold: Integer,String and a float
3.Lists are mutable,what does that mean?: The contents can be changed
4.Lists can be and to access elements: indexed, sliced
5.List Method:list.append(): Adds an element to the end of the list
6.The list currently is [1,2,3]
you use list.append(5)
What is the list now?: [1,2,3,5]
7.List method:list.insert(): Inserts an element at a specified position
8.The list currently is [1,2,3]
you use list.insert(1, 'a')
What is the list now?: [1,'a',2,3]
9.List method:list.extend(): Adds all elements of a list to the end
10.The list currently is [1,2,3]
1/
5
, you use list.extend(4,5)
What is the list now?: [1,2,3,4,5]
11.list method:list.remove(): Removes the first item with the specified
value
12.list method:list.pop(): Removes the element at the specified position
13.list method:list.clear(): Removes all elements from the list
14.The list currently is [a,1,a]
you use list.remove('a')
What is the list now?: [1,'a']
15.The list currently is [1,2,3]
you use list.pop(1)
What is the list now?: [1,3]
16.The list currently is [1,2,3]
you use list.clear
2/
5