Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Syntax

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What is the word (command) used to display numbers and text on the screen?

a)

print

b)

show

c)

output

d)

command

2.

What can be used to store information and values so that it can be used later?

a)

Graphic

b)

Variable

c)

Print

d)

Output

3.

What is a input?

a)

To plug in something.

b)

A function that allows us to ask the user to enter some data.

c)

Data displayed on a screen.

d)

A function

4.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
5.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
6.

Python is a

a)

text language

b)

database language

c)

programming language

7.

Code for

Five is greater than two!

a)

if 5 > 2:

print("Five is greater than two!")

b)

if 5 = 2:

print("Five is greater than two!")

c)

if 5 > 2: Print("Five is greater than two!")

8.

In a guessing game, what will the following code snippet output if guess is '15' and number is 15?

a)

Correct!

b)

Incorrect!

c)

Syntax Error

d)

AttributeError

9.

Which of the following Python code is correct?

a)

age = input ("What is your age? ")

b)

age=input ("What is your age? ")

10.

Which of the following Python code is correct?

a)

if age>=18:

print("Congrats! You are old enough to vote!!")

else:

print("You are NOT old enough to vote. Sorry Charlie")

b)

else:

print("You are NOT old enough to vote. Sorry Charlie")

if age>=18:

print("Congrats! You are old enough to vote!!")

11.

What must surround a string in Python code?

a)

Brackets ()

b)

Quote Marks " '

c)

Star *

d)

Hashtag #

12.

A 'string' appears what colour?

a)

Blue

b)

Green

c)

Yellow

d)

Black

13.

A 'print' message is what colour?

a)

Black

b)

Green

c)

Purple

d)

Blue

14.

Which is correct?

a)

A

b)

B

15.

What is the name of the variable in this program?

a)

print

b)

colour

c)

input

d)

" "