205k 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 "Go to McDonald's!" being printed?

1 Answer

3 votes

Final answer:

The value of is_breakfasttime should be True and the value of cash should be greater than 1 but less than or equal to 5.

Step-by-step explanation:

The code provided is a nested if-else statement in Python. It checks the values of two variables: is_breakfasttime and cash. To print the statement 'Go to McDonald's!', the value of is_breakfasttime should be True and the value of cash should be greater than 1 but less than or equal to 5.

  1. is_breakfasttime = True, cash = 2 - This combination would result in 'Go to McDonald's!' being printed.
User Jwize
by
7.1k points