
Explanation:
This statement will check if the variable day_of_week is equal to 1 and if the variable review_period evaluates to a truthy value. The use of the double equal sign (==) in the comparison of day_of_week is important, as a single equal sign (=) would be used to assign a value to the variable instead of checking its value. The use of a single ampersand (&) instead of the keyword and is not valid syntax in Python. The use of quotes around True in options B and C will result in a string comparison, which will not evaluate to True even if the value of review_period is True.
Ultimate access to all questions.
A data engineer only wants to execute the final block of a Python program if the Python variable day_of_week is equal to 1 and the Python variable review_period is True.
Which of the following control flow statements should the data engineer use to begin this conditionally executed code block?
A
if day_of_week = 1 and review_period:
B
if day_of_week = 1 and review_period = "True":
C
if day_of_week == 1 and review_period == "True":
D
if day_of_week == 1 and review_period:
E
if day_of_week = 1 & review_period == "True":