117k views
1 vote
1|>if is breakfasttime:

2|>>if cash > 10:
3|>>>print("Go to Egg Harbor!")
4|>>elif cash > 5:
5|>>>print("Go to Waffle House!")
6|>>elif cash > 1:
7|>>>print("Go to McDonald's!")
8|>else:
9|>>if cash > 20:
10|>>>print("Go to Atwood's!")
11|>>elif cash > 10:
12|>>>print("Go to Cypress!")
13|>>else:
14|>>>print("Go to Waffle House!")
Q: Which of the following values for is_breakfasttime and cash would result in nothing being printed at all?

User Elson
by
8.4k points

1 Answer

2 votes

Final answer:

Nothing will be printed if 'is_breakfasttime' is false and 'cash' is more than 1 but 10 or less, as the code has conditions only for cash amounts above 10 and 20 or 10 or less during non-breakfast times.

Step-by-step explanation:

The conditional statements in the provided code block are structured to print out a location for a meal depending on the time of day and the amount of cash on hand. If is_breakfasttime is true, there are different tiers of cash that determine where you go to eat. However, if it's not breakfast time, a separate set of conditions determine the eating location based on the cash available. To have nothing printed, the value of is_breakfasttime must be false (meaning it is not breakfast time), and the value of cash must be 10 or less but more than 1. This is because the last 'else' condition (line 14) only executes if cash is 10 or less and there is no condition to handle cash amounts greater than 1 and up to 10 if it's not breakfast time.

User Yannick K
by
8.5k points