WorksheetsPython Arrays
Total questions: 13
Worksheet time: 6mins
Which of these is a list?
fruit = ["apples", "oranges", "bananas"]
fruit = "apples", "oranges", "bananas"
fruit = {"apples", "oranges", "bananas"}
fruit = ("apples", "oranges", "bananas")
Each item in a list has an "address" or index. The first index in a Python list is what?
1
0
a
A
names = ["Paul","Phillip","Paula","Phillipa"]
What output will this code produce?
['France', 'Wales', 'England']
France
France Wales England
France
France, Wales, England
Wales
['France', 'Wales', 'England']
Wales
In programming, lists are often known as...
Arrays
Elements
Indexes
Data
List items have an index number. In the following list, which item has the index number of 3?
["John", "Harry", "Jesse", "John", "Harry", "Harry"]
"John"
"Harry"
"Jesse"
How do i remove something from a list?
variable.append()
variable.delete()
variable.remove()
variable=(new variable)
Which code would i use to add an item to a list?
variable.add()
variable.append()
append.variable()
add.variable()
variable.sort() will do what?
Sort the list into alphabetical order
Sort the list into reverse order
Create a new list
Error
What does the '#' allow you to do?
Repeat code
Comment on code
Print code
End code
An empty list can be declared as
fruitList = ""
fruitList = ["empty"]
fruitList == []
fruitList = []
Which of the following commands will return the length of the list mylist?
length(mylist)
len(mylist)
mylist.length()
mylist.len()
