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 Letter Game Refinement

Christopher Lobato
Christopher Lobato
1,625 Points

I have no idea what could possibly be wrong, but I'm getting a syntax error on a colon when I tried this script...

def welcome(): start = input("Press enter/return to start or Q to quit. ".lower()

if start == 'q':  <------------------------------  What could possibly be wrong here???
    print ("Bye!")
    sys.exit()
else:
    return True  

print ("Welcome to Leter Guess!")

done = False

while True: clear() welcome() play(done)

Hey Chris, did this ever get resolved?

2 Answers

Are you mixing tabs/spaces? Have you imported sys?

Christopher Lobato
Christopher Lobato
1,625 Points

This is the exact code he used in the video. I've redone the indentation a million times, sys has been imported. It just keeps popping up with a syntax error only on that colon.

Nikolai Montesclaros
Nikolai Montesclaros
11,928 Points

Not sure about the context of the question but syntactically I can see that you have a space on your print statement.

print("Bye")
Christopher Lobato
Christopher Lobato
1,625 Points

Here we go.

def welcome():
    start = input("Press enter/return to start or Q to quit. ".lower()
    if start == 'q':
        print ("Bye!")
        sys.exit()
    else:
        return True