wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Basics of python

Total questions: 11

Worksheet time: 6mins

Name
Class
Date
1.
How would you assign an integer to a variable?
a)
new_var = 4
b)
new_var == 4
c)
new_var = "4"
d)
new var "4"
2.
The number or word we give to a variable
a)
Value
b)
Bug
c)
Information
d)
Text
3.

To display something on the screen, use this command:

a)

print()

b)

Print()

c)

screen()

d)

write()

e)

display()

4.

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!)"

5.
To repeat a fixed number of times use a
a)
while loop
b)
for loop
c)
if loop
d)
indentation
6.
To create a newline at the end of prompt, you can use which of the following expressions?
a)
\new
b)
\n
c)
\break
d)
\return
7.

Which of the following functions display an output to the screen?

a)

display()

b)

output()

c)

print()

d)

post()

8.

Everything that we want do display in a print() function must:

a)

be inside parentheses - ()

b)

quotation marks - ""

c)

be inside single quotation marks - ''

d)

be inside hash marks - #

9.

An Operator is:

a)

A person that performs operations

b)

a symbol that specifies the operation to perform

c)

a symbol that means the code will run

d)

a line of code

10.
How would would you print a text string?
a)
output "Hello!"
b)
print ("Hello!")
c)
print (Hello!)
d)
output (Hello!)
11.
Choose the statement that assigns 4 to the power of 3 to the variable new_var...
a)
new_var = 4 ** 3
b)
new_var = 3 ** 4
c)
new var = 3 ** 4
d)
new_var = 4 ^^ 3