NEW
Font size
WorksheetsPython - Chpt 3 - Review
Total questions: 15
Worksheet time: 9mins
A variable that can only have two values, True or False is called a _____.
Boolean
elif
if
else
Which is the correct syntax for keying a Boolean?
has_dog = true
has_dog = "true"
has_dog = True
has_dog = TRUE
This operator means that one value is the same as the other value.
==
!=
>
<
What is the result of this program: (Use attached image)
A: True B: True
A: True B: False
A: False B: False
A: False B: True
What will be the output? (Use the attached image).
A: True B: True
A: True B: False
A: False B: False
A: False B: True
A syntax error means you have an error with your Python grammar or a symbol/operator is incorrectly used.
True
False
Which symbol do we use to add comments to our code?
@
#
+
&
What best defines an IF statement in Python?
An embedded string with a variable
Checks to see if a statement is true or false and then does one of two things depending on the result.
In Python, the data type for a Boolean will display as ___.
float
int
str
bool
In programming, what is iteration?
The repetition of steps within a program
A decision point in a program
The order in which instructions are carried out
Testing a program to make sure it works
The condition for a while loop to continue could include which of the following?
while something equals something
while something is true
while something is greater than something
All of these
while loops are ___.
loops which run an unknown number of times
the same as if statements
loops which run for a specific number of times
not a part of programming
To include the use of functions which are present in the random library we must use the option ____.
import random
import.random
library random
use random
The output of the following code is either 1 or 2.
True
False
Error
Contains functions related to generating random numbers and producing random results.
system module
random module
math module
none of these
