In this chapter, you learned a lot about how to write programs that can make decisions. Here are some questions to answer:
Q1. How many times can the elif
statement appear in the if
/elif
/else
flow?
Only once
Twice
As many times as it is needed
Ten
Q2. Which statement starts a conditional block of code that is used to make decisions?
else
if
elif
while
Q3. Which statement is only used at the end of a conditional block of code?
else
if
elif
while
Q4. What is a global variable?
A variable that is only used in one function
A variable that can be shared with many functions
A variable that uses global before its name if it is inside a function
Both 2 and 3
Q5. What is a while
loop?
A loop that runs code only once
A loop that runs code a set number of times
A loop that repeats code until something different happens, and then it stops
A loop that does nothing