DuckSama
DuckSama

Reputation: 13

(just a quick disclamer that im a complete beginner to programming) I keep getting this syntax error: SyntaxError: EOL while scanning string literal

this is the line that has as a syntax error:

print("he really liked the name " " + character_name + ", ")

its on line 5 btw. I've tried to go back to the course multiple times and checking it over, but my line of code is still the same.

I'm watching a course and I copied exactly what he's doing, what am i doing wrong?

image

Upvotes: 0

Views: 50

Answers (2)

ppwater
ppwater

Reputation: 2277

Those + signs are string concatenation, they go between strings. You have one more ".

print("he really liked the name " + character_name + ",")

Or do this:

print(f"he really liked the name", character_name, ",")

Or use string format

print("he really liked the name {0},".format(character_name))

Using f strings

print("he really liked the name {character_name},")

Upvotes: 0

devintark
devintark

Reputation: 76

Those + signs are string concatenation, they go between strings. So you have 1 too many quotes. It should be

print("he really liked the name " + character_name + ",")

Upvotes: 1

Related Questions