String Formatting with %, Part 2 issues... Help!

name = raw_input("What is your name?")
quest = raw_input("What is your quest?")
color = raw_input("What is your favorite color?")

print "Ah, so your name is %s your quest is %s, " \
"and your favorite color is %s." %s (name, quest, color)

What is wrong with this code? I always get the "Traceback (most recent call last): File "python", line 6, in NameError: name 's' is not defined" error ???


%s in a string doesn't try to find a variable by that name, but you're using s somewhere else as well.


%s (name, quest, color)
The issue is in your %s in the line above you should use % only


I'm sorry but Im still very new to coding. I dont understand Python to well, can you please explain better?


Your mistake was using adding a "s" at the end of %.
Correct % (name, quest, color)
Incorrect %s (name, quest, color)

Unless what you're trying to ask is, what's the difference between the string method "%s" and "%"?


thanks mate. that's great help. :slight_smile: