Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Identify Invalid Python Syntax (Summary)

In this course, you’ve seen what information the SyntaxError traceback gives you. You’ve also seen many common examples of invalid syntax in Python and what the solutions are to those problems. Not only will this speed up your workflow, but it will also make you a more helpful code reviewer!

When you’re writing code, try to use an IDE that understands Python syntax and provides feedback. If you put many of the invalid Python code examples from this course into a good IDE, then they should highlight the problem lines before you even get to execute your code.

Getting a SyntaxError while you’re learning Python can be frustrating, but now you know how to understand traceback messages and what forms of invalid syntax in Python you might come up against. The next time you get a SyntaxError, you’ll be better equipped to fix the problem quickly!

Download

Sample Code (.zip)

2.5 KB
Download

Course Slides (.pdf)

479.4 KB
Avatar image for mikesult

mikesult on Aug. 12, 2020

Thanks, full of good information to know.

Avatar image for Ghani

Ghani on Oct. 25, 2020

Very interesting; thanks!

Avatar image for thecocoa

thecocoa on Dec. 8, 2020

Thanks, Darren. Good stuff (for me) to know. I really tried to replicate the tab_space.py error, but my IDE wouldn’t allow it (as you said). I spent too long trying to replicate the problem, but my IDE was much smarter than I was ;-) Lesson learned!

Become a Member to join the conversation.