0

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!

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
Nazar
  • 1
  • 1

1 Answers1

-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}")

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
Rabee 12
  • 1
  • 1