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

Unlock This Lesson

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

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please refer to our video player troubleshooting guide for assistance.

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

mikesult on Aug. 12, 2020

Thanks, full of good information to know.

Ghani on Oct. 25, 2020

Very interesting; thanks!

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.