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 trialAbrar Fahim
1,071 Pointssyntax errors in letter game
I keep on getting a syntax error on line 34 even though I did everything he did
5 Answers
Jon Mirow
9,864 PointsHi there!
Could you paste in your code? If you've not done before, just put three back ticks before and after so it shows up formatted :)
Jon Mirow
9,864 PointsWhat's the error you get from python? I see that in this line:
elif guess in bad_guess or guess in good_guess:
you're checking bad_guess and good_guess, but earlier they're called:
bad_guesses = []
good_guesses = []
Although that should throw a NameError? Maybe I'm misreading the code sorry?
Abrar Fahim
1,071 PointsI have fixed that but I still keep getting an error in line 34 about syntax error
Jon Mirow
9,864 Pointscool, it's a bit hard to read, could you paste in lines around there? like 30 - 35? :)
Abrar Fahim
1,071 Pointsfor letter in secret_word: #27
if letter in good_guesses:
print(letter, end ="")
else:
print("_", end = "")
print("")
print("Strikes {}/7".format(len(bad_guesses))
print("") #34
Jon Mirow
9,864 PointsOh!
print("Strikes {}/7".format(len(bad_guesses))
has three open brackets and two close brackets :)
Abrar Fahim
1,071 Pointsthank you
Abrar Fahim
1,071 PointsAbrar Fahim
1,071 Points