NEW
Font size
WorksheetsIntroduction to Python
Total questions: 15
Worksheet time: 29mins
Which of the following is a command to have a message appear on the screen?
write
msg
input
Which of the following Python command can be used for WHOLE numbers?
input
int
float
Which of the following is a Python command to work with DECIMAL numbers?
input
int
float
What would be printed by the command
print('12-5')
12-5
'12-5'
7
'7'
print(Hello world!)
Which of the following is used in Python to give a value to a variable
:=
==
=
What is the value(?) if theoutput is 12
x = 5
y = ?
print (x+y)
"7"
=7
7
/7
Which one is NOT a valid variable name?
my_var
myvar
_myvar
my var
Variable names can start with...
...only capital letters.
...any number, letter or an underscore (_).
...any letter or symbol.
...any letter or an underscore (_).
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
Which of these is the correct code for creating a list of names?
nameList = John, Harry, Mac, Donald, Colonel, Tony
nameList = ("John", "Harry", "Mac", "Donald", "Colonel", "Tony")
nameList = ["John", "Harry", "Mac", "Donald", "Colonel", "Tony"]
nameList = [John, Harry, Mac, Donald, Colonel, Tony]
