wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python If Else Statements

Total questions: 15

Worksheet time: 24mins

Name
Class
Date
1.
The second part of if, that is executed when the condition is false
a)
if
b)
else
c)
for
d)
input
2.
Which statement will check to see if a is equal to b?
a)
if a == b
b)
if a = b:
c)
if a != b:
d)
if a == b:
3.

What is the output?

a)

more than 7

b)

more than 23

c)

spam

d)

7

4.

Pieces of code that only run "under certain conditions":

a)

conditional statements

b)

control flow statments

c)

syntax

d)

variables

5.

Which symbol means "not equal to"?

a)

==

b)

<=

c)

>=

d)

!=

6.

Which character must be at the end of the line for if?

a)

:

b)

;

c)

.

d)

{

7.

What does the = = symbol mean in Python?

a)

Equal to or shows equality

b)

Not Equal

c)

Code that will be skipped

d)

End of clause

8.

What is the output?

a)

True

b)

False

c)

condition1

d)

condition2

9.

What is the output?

a)

250.0

b)

200.0

c)

300.0

d)

350.0

10.

What will be displayed at the end of the program?

a)

Case 1

b)

Case 2

c)

Nothing will be displayed.

d)

Case 1 and Case 2

11.

What will be displayed at the end of the program?

a)

Case 1

b)

Case 2

c)

Nothing will be displayed.

d)

Case 1 and Case 2

12.

What will display at the end of the program running?

a)

You can ride the carousel!

b)

Nothing will display

c)

You cannot ride the carousel!

d)

There will be an error.

13.

What will display at the end of the program running?

a)

You can ride the carousel!

b)

Nothing will display

c)

Sorry! Not tall enough!

d)

There will be an error.

14.

What will display at the end of the program running?

a)

You can ride the carousel!

b)

Nothing will display

c)

Sorry! Not tall enough!

d)

There will be an error.

15.

What questions do you have about If Else Statements?

4 lines