WorksheetsECDL Python Lesson 14 recap
Total questions: 60
Worksheet time: 32mins
print("Hello" + str(2) + "world!")
print("Hello world!\nHello world!")
Hello world!
What does the following code do? myAge = int (myAge)
Converts the var (variable) myAge to a string
Converts the var (variable) myAge to a integer
Converts the var (variable) myAge from a integer to a string
Converts the var (variable) myAge to if statement
print(Hello world!)
print("Hello world!" * 2)
people = ["John", "Rob", "Bob"]
print (people[1])
what would this result be?
people = ["John", "Rob", "Bob"]
print (people[-1])
what would this result be?
people = ["John", "Rob", "Bob"]
print (people[4])
what would this result be?
What are the names of the two types of mode that are used in Python? Select two.
Interactive mode
Scratch mode
Imperial mode
Script mode
print(3*4+5)
A syntax error means your code has a 'grammar' mistake or you used symbols/operations incorrectly.
True
False
Which is the correct way to assign an integer to a variable?
myNumber = 6
myNumber = "6"
myNumber = int("six")
myNumber == 6
What is the correct format of the print statement?
print("Python is cool")
print("Python is cool)
print "Python is cool"
print(Python is cool")
What does this output?
print("T" + "G" + "I" + "F")
TGIF
T G I F
TypeError
NameError
What would this print?
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Jesse, Ann , Harry, Harry
nameList = ("John", "Harry", "Jesse", "Ann", "Harry", "Harry")
nameList = ["John", "Harry", "Jesse", "Ann", "Harry", "Harry"]
nameList = [John, Harry, Jesse, Ann, Harry, Harry]
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"
"Ann"
Which of these pieces of code would return the name "Harry" from the following list?
nameList = ["John", "Harry", "Jesse", "John", "Ann", "Larry"]
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 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
