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
Zinar Qasim
1,331 PointsHelp ---------- (PYTHON)
I still cannot figure out this, I get Syntax Error on line 26 (ELSE statement) and when I comment out both else and the following print I get this >>> invalid literal for int() with base 10: - (it refers to the print after except)...
Please see SNAPSHOT >>> https://w.trhou.se/nvoydwbv4s
Thank you...
2 Answers
Steven Parker
243,656 PointsThis is almost exactly the same issue as in your previous question today.
The code on lines 23 and 24 is indented to the same column as the "if" on line 21. This causes the "if" to be considered complete and the "else" on line 26 becomes a syntax error because it has no associated "if".
When I comment out lines 26 and 27 I don't see the other error. If you need help with that, put the comments in yourself and when you have confirmed that the error still happens, make a fresh snapshot.
Zinar Qasim
1,331 PointsOkay, now, it says unexpected indent on line 26 after some changes >>> https://w.trhou.se/n7jdcicn12 ..
and for the line 16, it is not an error it just says (invalid literal for int() with base 10: ) it is not supposed to appear like that, this happened after I added (as err) in the exception.
btw thank you very much for replying to my questions, you helped me a lot today!
Steven Parker
243,656 PointsThe "unexpected indent" is because line 24 has no indent which ends the loop completely.
You should also be consistent about how far each level is indented. This program has some levels going 8 spaces, some 4, and some 2!