We’re glad to help.
Please remember that for various reasons, automated assistants such at ChatGPT can make mistakes. Be careful not to become overly dependent on them, because that could impede your learning of Python.
It is important to practice understanding error messages that are issued by the Python interpreter. The document 8. Errors and Exceptions provides some helpful information about that. Notice that it points out that when there is a SyntaxError
, the message identifies a line number where it was discovered. When that happens, check that line and the previous one. Sometimes a SyntaxError
relates to something that was done by mistake on the line prior to the one on which the Python interpreter discovered that there was a problem.
Some of us here initially had trouble finding the problem that you reported, because your code was not formatted properly for posting. The page About the Python Help category explains how to format posted code with the use of Markdown backticks.
After your code was properly formatted, the only obvious problem was not actually a SyntaxError
. Rather it was a mistake in the formatting of the output.
We wish you the best of success in learning Python!