PY4E Chapter 3 - Conditional Execution
Questions and Answers
This is an insurance policy in the case that our code breaks, and we don't want the program to
stop running
bool ANSWER-One of Python's built-in data types. It's used to represent the truth value
of an expression. It's value is either true or false
What is the difference between the assignment and the comparison operators? ANSWER-
Assignment to a variable is achieved by using a single = sign. Comparison uses a double equals -
== to evaluate whether two values are equal (return true if so and false if not)
conditional statement ANSWER-A statement that controls the flow of execution
depending on some condition.
condition ANSWER-The boolean expression in a conditional statement that determines
which branch is executed.
short-circuit of logical expression ANSWER-Python is part-way through evaluating a
logical expression and stops the evaluation because Python knows the final value for the
expression without needing to evaluate the rest of the expression.
For example, if a condition can only be true if two logical expressions are both true, and the first
one is false, there is no need to evaluate the second one.
Questions and Answers
This is an insurance policy in the case that our code breaks, and we don't want the program to
stop running
bool ANSWER-One of Python's built-in data types. It's used to represent the truth value
of an expression. It's value is either true or false
What is the difference between the assignment and the comparison operators? ANSWER-
Assignment to a variable is achieved by using a single = sign. Comparison uses a double equals -
== to evaluate whether two values are equal (return true if so and false if not)
conditional statement ANSWER-A statement that controls the flow of execution
depending on some condition.
condition ANSWER-The boolean expression in a conditional statement that determines
which branch is executed.
short-circuit of logical expression ANSWER-Python is part-way through evaluating a
logical expression and stops the evaluation because Python knows the final value for the
expression without needing to evaluate the rest of the expression.
For example, if a condition can only be true if two logical expressions are both true, and the first
one is false, there is no need to evaluate the second one.