Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics (2015) Letter Game App Exiting

Adam Siwiec
Adam Siwiec
12,070 Points

Tested the code, and it works. Keep getting a challenge error "Try Again"

Keep getting the try again error on Python basics challenge question.

firedoor.py
import sys

inputs = input("test ")
if inputs != "n" and inputs != "N":
    print ("Enjoy the show!")
else:
    sys.exit(0)

Sometimes the challenge is looking for a specific output or specific syntax; even though the code may work it might not be what the challenge is looking for.

2 Answers

Silviu Popovici
Silviu Popovici
20,433 Points

Taking the 0 out of sys.exit(0) worked for me

Sarah Dwyer
Sarah Dwyer
2,060 Points
  1. it should be an if-or statement, not if-and ---> if ans =='n' or ans =='N':
  2. within the if statement place sys.exit() & within the else statement print("Enjoy the show!)
  3. remove the space between the print statement and the parenthesis
  4. remove the zero from sys.exit()