C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
So: To fix the program, we can add a colon to the indicated location. Until then, the program cannot be executed.
Python program that causes SyntaxError
cats = ["Fluffy", "Mildred", "Joe"]
for cat in cats
print(cat)
Output
File "C:\programs\file.py", line 5
for cat in cats
^
SyntaxError: invalid syntax
Python program that causes no error
cats = ["Fluffy", "Mildred", "Joe"]
for cat in cats:
print(cat)
Output
Fluffy
Mildred
Joe
Note: In an experiment, I found the SyntaxError penetrates all "except" statements. This error occurs before the program is run.