Strings and console output


#1



String Formatting with %, Part 2


File "python", line 6
"and your favorite color is %s." ___ (name, quest, color)
^
SyntaxError: invalid syntax


Replace this line with your code.


#2

I'm guessing that's because there is no hard escape character () in the previous line (plus you'll get an error since you still have ___(name, quest, color)).
Replace this line and the previous line with the following:

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

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.