LPTHW(Python 3) Ex17 code problem

I am diligently working my way through the exercises and have come up with an error that I can’t seem to figure out.

When I run the ex17.py script, I get a syntax error at line 14.

PS C:\Users\James\lpthw> python ex17.py test.txt new_file.txt
File “ex17.py”, line 14
print(f"Does the output file exist? {exists(to_file)}")
SyntaxError: invalid syntax

But when I troubleshoot the code itself, it seems to look exactly the same as the sample code.

Well, I’m a big dummy. I figured out that the problem at line 14 was really the lack of a close parenthesis at the end of line 12.

I also discovered an error on line 19.

Syntax is hard.


Sometimes the process of writing it out as a post presents the answer. I write a blog specifically for this reason as often find writing it out helps find a solution or embedded errors.