Worksheetspython-lists
Total questions: 10
Worksheet time: 4mins
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
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 the index number for 'Spain'?
['England','Brazil','Spain','France']
0
1
2
3
What is used to separate elements in a list?
Bracket
Comma
Full Stop
Space
What brackets are used to create a list?
()
[]
What does the '#' allow you to do?
Repeat code
Comment on code
Print code
End code
Which of these operators means EQUAL TO?
'='
'=>'
'<='
'=='
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"
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]
>>>str="hello"
>>>str[:2]
>>>
