Reputation: 13
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?
Upvotes: 0
Views: 50
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
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