What am I doing wrong here - %s not working



This is the error message I am getting
File "python", line 6
"and your favorite color is _%s__." _%__ (name, quest, color)
SyntaxError: invalid syntax

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__." _%__ (name, quest, color)



The instructions are

Now it's your turn! We have ___ in the code to show you what you need to change!
Inside the string, replace the three ___ with %s.
After the string but before the three variables, replace the final ___ with a %.
Hit Save & Submit Code.
Answer the questions in the console as they pop up! Type in your answer and hit Enter.

There shouldn't be any underscores in your final answer. It looks like you inserted the %s and % inside of the underscores rather than replacing them.

EDIT: Ugh. I hit my first-day post limit D: I'm glad to help and even gladder that you managed to debug yourself :smiley:


Thank you :). I actually figured that out after the last % had to delete the existing underscore.
then it worked .. I was going to post here that I was able to work the code after I deleted those extra undescores


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