If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Trace nested conditionals

Problem

Kyle is designing an automated phone line for his restaurant.
answer = input("Hi, how can I help you?")

if answer == "reservations":
    num_people = int(input("How many people?"))

    if num_people >= 8:
        print("Sorry. That exceeds our party limit.")
He wants the program to print, Reservation booked. if the number of people entered is less than 8. This should still only happen if the user entered reservations in response to the first question.
Which modification to the program best meets Kyle's requirements?
Choose 1 answer: