Boolean logic

Report a typo

Which logical operator is an alternative to the nested if statements?

Suppose we were about to rewrite this code snippet:

if sound == "music":
    if n_people > 10:
        print("We are at the party!")

as follows:

if sound == "music" ... n_people > 10:
    print("We are at the party!")

What operator must be placed instead of ... in this case?

Select one of the built-in boolean operators: and, or, not. Take into account that we may need a binary operator to combine conditions.

Enter a short text
___

Create a free account to access the full topic