'SyntaxError: invalid syntax in Python? [duplicate]

I have recently started learning programming by watching CS50 course. I am currently on the introduction of Python. Everything was done by me in accordance to that video-course. By writing simple code I get an issue unlike my lecturer does.

Here it is:

answer = input("What's your name?")
print(f"hello, {answer}")

Issue I have got:

File "hi.py", line 2
    print(f"hello, {answer}")
                           ^
SyntaxError: invalid syntax

I would be sincerely grateful for your answer!



Solution 1:[1]

hello you can't use the print function in the Variable so the right way to write this is

answer = input("What's your name?") 
print(f"hello, {answer}")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Chris