Stuck on question 15 part 2


#1

I don't understand I tried a few things but its still not working.


#2

So the exercise is asking you to change the __ with %s, which are placeholders.
For example if we do:

name = "Ricky"
print "Hello %s." % (name)

The output will be:

Hello Ricky.
Remember what the exercise says: "we used the % operator to replace the %s placeholders"
So:

print "Hello %s." %

And : "with the variables in parentheses."

Which means:

print "Hello %s." % (name), assigning the variable in the parentheses after the operator % helps python recognize that it's the variable we want to assign inside the string placeholder %s! remember the order inside the parentheses after the operator % is important.

Let me know if you still need any further explanation or anything in general!


#3

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)

So i follow the instructions but after clicking the ' Save & submit ' button it shows an error. The 'Hint' section tells me to type in my name in the console and hit ' enter ' but i can't type anything in the console window. please help me out.


#4

Your code is good, you just forgot to delete the __, delete them all and it should look like:

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

I hope it's clear, let me know if you need any further help or explanation :smiley:


#5

Thanks a lot . That was a silly mistake :stuck_out_tongue:


#6

Thanks for the help. Finally figured it out