WorksheetsSeptember Quiz: Python
Total questions: 20
Worksheet time: 10mins
What will be the output?
name = "Dave"
print (name)
Dave
'Dave'
name
(name)
How did python get its name?
The creator invented it whilst in hospital from a snake bite
The code is written in a snaking structure
The creator named it after Marty Python
The creator named it after Monty Python
What will be the output if the user enters 'child' and 'friday'?
£4.00
£2.50
There will be a syntax error
£2.00
What will be the output of: print ("3+57")
3 + 57
90
60
3+57
REPEAT loops can only be used when:
The integers in a calculation aren't decimal
The data to be repeated is in hexadecimal
They don't exist in python
Dealing with named variables
What does MOD do in a calculation
returns the decimal outcome of a division
returns the remainder after a division
divides a previous division statement
returns two divided integers to their initial value
What can be used to create a line break in printed text?
\N
\\n
/n
\n
How many variables can you assign in a piece of code?
Depends on your PC's clock speed
256
infinity gauntlet
infinite
holds whole numbers
holds a decimal point in a number
Which of the following is used in Python to calculate ten squared?
If you want to create an empty list called colours in Python, which of the following is correct?
colours = [ ]
colours = ( )
colours = { }
colours = <>
What letter will be printed on the screen after running this code:
n
e
a
Nothing prints
List items have an index number. In the following list, which item has the index number of 3?
["John", "Harry", "Mac", "Donald", "Colonel", "Tony"]
"Tony"
"Harry"
"Mac"
"Donald"
The list needs one more name added to the end - "Stark". Which piece of code below would do this?
nameList = ["John", "Harry", "Mac", "Donald", "Colonel", "Tony"]
nameList.append(Stark)
append(nameList,"Stark")
nameList.append["Stark",7]
nameList.append("Stark")
What will be the output?
tuple1=['sam', "Pam", 12,44]
print(type(tuple1))
<class 'list'>
<class 'tuple'>
