Font size
WorksheetsPython
Total questions: 24
Worksheet time: 12mins
What is Python ?
Which of the following is a data type in Python? Select multiple answers.
int
words
string
decimals
A list is changeable and unordered
True
False
What would be printed by the command
print('12-5')
12-5
'12-5'
7
'7'
Which function changes a string to a float?
float()
num()
print()
change()
What will be the output of the following statement?
type('5')
str
int
float
Boolean
people = ["John", "Rob", "Bob"]
print (people[1])
what would this result be?
John
Rob
Bob
Python identifies blocks of code by
(and)
guessing
aligning up the starts of lines (indentation)
What will the output be from the following code?
print("Hello world!" * 2)
TypeError
Hello world! * 2
Hello world!Hello world!
Hello world world!
What will the output be from the following code?
print(Hello world!)
Hello world!
Hello world
SyntaxError
print(Hello world!)
What syntax can you use to insert a line break between strings so that they appear over multiple lines?
/
\n
\l
n/
What will the output be from the following code?
print("Hello" + str(2) + "world!")
Hello world! Hello! world!
Hello2world!
Hello Hello world! world!
SyntaxError
What will the output be from the following code?
print("Hello world!\nHello world!")
Hello world! Hello world!
SyntaxError
Hello world!
Hello world!
Hello world!
What is syntax?
Syntax is the rules of the programming language
It is used to read information
Syntax is the word used to describe an error
Tells the interpreter that the code which follows is a function
const
def
int
elif
What is python named after
The snake
Television show called Monty Python
What does the following code do? myAge = int (myAge)
Converts the var (variable) myAge to if statement
Converts the var (variable) myAge to a integer
Converts the var (variable) myAge to a string
Converts the var (variable) myAge to a integer
What is the position of the name "Robert" in the following list:
0
1
2
3
What is the Python built-in function to converts a number to a string?
str()
int()
parseint()
convert
What does the term 'debug' mean?
Looking at code
A set of instructions
Identify errors and fix them.
Making a calculation
A location in memory used to store data that can be changed.
Variable
Iteration
Constant
Value
What symbol do you use to make a comment in Python?
;
#
@
What extension must you add to the end of a file when saving?
.png
.py
.xlsx
.docx
.jpeg
