Print String in Python

Question:

I tried running this basic python script to print something, and it doesn’t seem to be executing properly.

name = "Tyler";
print{name};

I am getting this error:

File "C:Userstylermain.py", line 2
    print{name};
    ^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

I tried changing line 2 to:

print(...)

but it prints out
Ellipsis, not my name.

Asked By: Tyler Emanuel

||

Answers:

You don’t need semicolons in Python
The issue was the use of curly braces. Call your variable name with print() like this:

name = "Tyler"
print(name)
Answered By: Wolric
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.