No student devices needed. Know more
15 questions
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Jesse, John, Harry, Harry
nameList = ("John", "Harry", "Jesse", "John", "Harry", "Harry")
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList = [John, Harry, Jesse, John, Harry, Harry]
List items have an index number. In the following list, which item has the index number of 3?
["Joe", "Harry", "Jesse", "John", "Harry", "Harry"]
"John"
"Harry"
"Jesse"
"John"
Which of these pieces of code would return the name "Harry" from the following list?
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList()
nameList[1]
NameList(4)
nameList["4"]
The list needs one more name added to the end - "Felipe". Which piece of code below would do this?
nameList = ["John", "Harry", "Jesse", "John", "Harry", "Harry"]
nameList.append(Felipe)
append(nameList,"Felipe")
nameList.append["Felipe",7]
nameList.append("Felipe")
To insert an the string "strawberries" in the first position of a list we use
fruit.append("strawberries, 1")
fruit.insert("strawberries",0)
fruit.insert(1, "strawberries")
fruit.insert(0, "strawberries")
Is this the correct code for a list?
register = {"Sam", "Pheobe", Georgia", Richard"}
Yes
No
To print a list called fruitList we use
print(fruitList)
list(print)
fruitList.print()
fruitList(print)
Which colour will be replaced with yellow?
red
green
blue
none, yellow will be added to the list
This list contains items of what data type?
String
Boolean
Float
Integer
Which symbols are used to open and close a list?
( ) round brackets
( ) curly brackets
[ ] square brackets
" " speech marks
Consider the list:
myList=["red", "orange", "yellow"]
What would the following statement print?
print(myList[2])
This is a value Index Error
yellow
orange
red
Consider the list:
myList=["r", "o", "y", "g", "b", "i", "v"]
What prints from the following statement?
print(myList[0:3])
[r, o, y]
['r', 'o', 'y']
['r', 'o', 'y', 'g']
nothing, this is an error
Explore all questions with a free account