Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Logical Path (Need Help Please)

Howdy and welcome to the forum!

We can see your code in the screenshot, but please post it properly formatted. You can learn how here: [Essentials] How To Post/Format Your Code Correctly

Also, please describe the issue you are having…what’s the problem?

# 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 or secretB == True:
    hero.moveXY(32, 33)
else:
    hero.moveXY(32, 15)
hero.moveXY(38, 24)
# If secretB is NOT true, take the high path.

if secretB == False:
    hero.moveXY(44, 32)
else:
    hero.moveXY(44, 15)

I am having problem with the last 2 things. #If EITHER secretA or secretB is true, take the high path. #If secretB is NOT true, take the high path. Im having trouble doing it in code form. I’m also not sure what’s wrong in the code I wrote.

So…where does the hero need to end at? You are missing the final statement.