123k views
4 votes
Which if statement does not check for the condition "the month is between May and August and num_finals_left is zero?" Assume that month is a string, so we are checking if month is one of "May" "June" "July" "August". You can also assume num_finals is an integer. a. if month in ["May", "June", "July", "August"] and num_finals == 0: b. if month in ["May", "June", "July", "August"] and not num_finals: c. if month == "May" or month == "June" or month == "July" or month == "August" and num_finals == 0: d. if (month == "May" or month == "June" or month == "July" or month == "August") and num_finals == 0

User Jbtamares
by
3.6k points

1 Answer

3 votes

Answer:

Option b if month in ["May", "June", "July", "August"] and not num_finals:

Step-by-step explanation:

The if statement in the option b doesn't meet the objective to check if num_finals is zero. It just use a not operator which is not relevant here. The num_finals is an integer and therefore to check if num_finals is zero, the correct statement should be num_finals == 0 The "==" is an equality operator to check if a left value is equal to the right value. The rest of the three options are correct as they meet the checking requirements.

User Npjohns
by
3.7k points