WorksheetsPYTHON BASIC
Total questions: 18
Worksheet time: 9mins
Which of the following is a command to have a message appear on the screen?
write
msg
input
Pick the Python command used to make the user type in some data (input the data)
get
input
int
float
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'
Which of the operators do we use if we want at least one condition to be true?
and
or
else
not
print(Hello world!)
Which of the following is used in Python to give a value to a variable
:=
==
=
What is the result of the following operation?
print(1 + 4*3)
11
12
13
15
What is the value(?) if theoutput is 12
x = 5
y = ?
print (x+y)
"7"
=7
7
/7
What is a variable?
A named block of memory, used whilst a program is running to store data.
A named block of memory, where the results of a program get stored once it has been closed down.
A block of computer memory that gets permanently named after the variable, even when the program is closed down.
A process within the cpu, that is given a specific name by the program, so it is easier to identify.
Which one is NOT a valid variable name?
my_var
myvar
_myvar
my var
What is the correct file extension for Python files?
.py
.pt
.pyt
.pyth
How do you create a variable with the numeric value 5?
Both are correct
x=5
x=int(5)
What will be the output of this code?
x = “2”
y = “4”
z = int(x) + int(y)
print(z)
6
6.0
both are correct
The input function prompts the user for input, and returns what they enter as a string
TRUE
FALSE
Below is the code for printing student's name. What is the best answer to put in (?)
name = student
print ( ? )
text
name
student
What will be the output when a user enters WILLIAM
name = input("Enter your name: ")
print("Hello, " + name)
Hello name
Hello William
Helloname
Hello WILLIAM
