# Logical Path Python

Can someone help?

``````# Get two secret true/false values from the wizard.
# Check the guide for notes on how to write logical expressions.
hero.moveXY(14, 24)
secretA = hero.findNearestFriend().getSecretA()
secretB = hero.findNearestFriend().getSecretB()

# If BOTH secretA and secretB are true, take the high path; otherwise, take the low path.
secretC = secretA and secretB
if secretC:
hero.moveXY(20, 33)
else:
hero.moveXY(20, 15)
hero.moveXY(26, 24)

# If EITHER secretA or secretB is true, take the high path.
if secretA == true:
hero.moveXY(38, 24)
if secretB == true:
hero.moveXY(38, 24)
# If secretB is NOT true, take the high path.
if secretB == false:
hero.moveXY(50, 24)

``````

The problem is with your last 2 sections of code:

``````## FIRST SECTION ##
# If EITHER secretA or secretB is true, take the high path.
if secretA == true:
hero.moveXY(38, 24)
if secretB == true:
hero.moveXY(38, 24)

## SECOND SECTION ##
# If secretB is NOT true, take the high path.
if secretB == false:
hero.moveXY(50, 24)
``````

In the FIRST, you have two stacked if statements. Instead, you should use an if/else, with the βorβ comparison. If true, take high path, otherwise take low path.

In the second, you are trying to move directly to the exit point (50, 24). Instead, you need to move either high or low first, and then to the exit.

1 Like

Thank you! I was able to complete it.