NEW
Font size
WorksheetsPython-list
Total questions: 21
Worksheet time: 12mins
Ireland
Which symbols are used to open and close a list?
( ) round brackets
( ) curly brackets
[ ] square brackets
" " speech marks
What is a list in python?
A collection of variables
A collection of items assigned to a single variable
A statement that cant be changed
A Christmas list
This list contains items of what data type?
String
Boolean
Float
Integer
What is the index number for 'Spain'?
['England','Brazil','Spain','France']
0
1
2
3
Which of these codes is correct for creating a list of numbers?
num = ('10','29','37','109')
num = [10, 29, 37, 109]
num == ('10','29','37','109')
num = ['10 29 37 109']
What is used to separate elements in a list?
Bracket
Comma
Full Stop
Space
what will be the Output:
print([1,2,3,4] + 5)
[6,7,8,9,10]
[1,2,3,4,5]
Generates an error
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"]
Consider this list, what will be the highest index the list can have:
li=[1,2,3,4,5]
2
3
4
5
The count() method returns the number of times the specified element appears in the list.
What is the output of this code?
3
2
1
0
Output of this code?
[2,4,6,8,10]
['2','4','6','8','10']
[0,2,4,6,8]
[10,8,6,4,2]
mylist = ["a","b"]
mylist[1] = "c"'
print(mylist)
["a","c"]
["a","b"]
["a","b","c"]
mylist
Which of these operators means EQUAL TO?
'='
'=>'
'<='
'=='
