wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Basics and Syntax

Total questions: 9

Worksheet time: 8mins

Name
Class
Date
1.

To display something on the screen, use this command:

a)

print()

b)

Print()

c)

screen()

d)

write()

e)

display()

2.

To display the following on screen

Hello World!

the following command should be used:

a)

print(Hello World!)

b)

print("Hello World!")

c)

print("Hello World" + !)

d)

print"(Hello World!)"

3.

x = 5

y = 6

print(x*y)


The code above displays the following:

a)

11

b)

x*y

c)

Syntax Error

d)

30

4.

x = 5

y = 6

print("x*y")


The code above displays the following:

a)

11

b)

x*y

c)

Syntax Error

d)

30

5.

x = 5

y = 6

print(x*y)


Select the correct answer(s):

a)

x is a variable

b)

x is a value

c)

print() is a funciton

6.

age = 16

message = "my age is: "

print (message, age)


Select the correct answer(s) below:

a)

the output would read:

my age is 16

b)

age is a variable

c)

16 is assigned to the age variable

7.

cakeAmount = input()

print ("We have", cakeAmount, " cakes")


The above code is run. You type:

six


Select the correct output.

a)

We have 6 cakes

b)

We have six cakes

c)

Error

8.

age = int(input("Enter Age (as integer): "))

newAge = age + 20

print ("your age in 20 years is:", newAge)


you enter

15

a)

value of age is 15

value of newAge is 35

output is: your age in 20 years is: 35

b)

value of age is 15

value of newAge is 20

output is: your age in 20 years is: 20

c)

value of age is 15

value of newAge is "age + 20"

output is: your age in 20 years is: 35

d)

value of age is 15

value of newAge is 35

output is: your age in 20 years is:35

9.

Operators used in python:


divide, multiply, add, subtract

a)

/, *, +, -

b)

div, mul, +, -

c)

\, x, +, -

d)

~, *, +, -