wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Basics

Total questions: 15

Worksheet time: 9mins

Name
Class
Date
1.

How would you print a text string?

a)

output "Hello!"

b)

print ("Hello!")

c)

print (Hello!)

d)

output (Hello!)

2.

x = 5

y = 6

print("x*y")


The code above displays the following:

a)

11

b)

x*y

c)

Syntax Error

d)

30

3.
What would print (10 + 16) produce?
a)
20
b)
22
c)
24
d)
26
4.

A data type that can have one of two values: True or False

a)

boolean

b)

variable

c)

modulo

d)

interpreter

5.

Integers are ____________ and floats are _____________

a)

whole numbers and exponents

b)

powers and fractions

c)

fractions and whole numbers

d)

whole numbers and decimal numbers

6.
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
7.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
8.

Which one is NOT a valid variable name?

a)

my_var

b)

myvar

c)

_myvar

d)

my var

9.

Variable names can start with...

a)

...only capital letters.

b)

...any number, letter or an underscore (_).

c)

...any letter or symbol.

d)

...any letter or an underscore (_).

10.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus + 
c)
forward slash /
d)
asterisk *
11.

a = 30

b = 20

print(a-b)

a)

20

b)

10

c)

50

d)

90

12.

which one of these variable is wrong?

a)

_what = 'hello world'

b)

1what = 'hello world'

c)

what = 'hello world'

13.
Which statement correctly assigns the string "Tanner" to the variable name?
a)
name  = print( "Tanner")
b)
input("Tanner")
c)
name = "Tanner"
14.

what will be the answer of this question

Num = 90

Num = 20

print(Num)

a)

110

b)

100

c)

20

d)

80

15.

What do we use variables for?

a)

for storing data.

b)

for printing commands.

c)

for comment