"String Formatting With %, Part 2"


#1

Hello Codecademy Team,

I am currently doing your introductory "Python" programming language course, "String Formatting With %, Part 2" and after answering the three questions, the code keeps running. Could you please help me solve this problem? I would really appreciate it! Thanks!

Sincerely,

Ian Michael Jones


#2

This should better illustrate my "Python" program language problem. My syntax states, print "Ah, so your name is %s__, your quest is _%s__, " \ "and your favorite color is _%s__." %. However, the code keeps running.

Sincerely,

Ian Michael Jones


#3

Be sure to replace the underscores with %s.

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

#4

If the program appears to be hanging, then go back to the previous lesson in the hamburger menu, and Submit it and proceed to next lesson. That will start a new session. Submit your exercise again (with any corrections necessary) and it should go through.


#5
 I replaced all of the underscores with "%s." I will try your suggestion.

#6

After trying your suggestion it comes up with an error after I answered the three questions in "". "Error Line 6." Please Help!


#7

The dot is a full stop in the text, not part of the %s syntax, so you know. I tested the earlier example with success, so don't have any further suggestion.


#8

My code syntax was the same as yours, but after I ran the code, it says, "Not enough arguments in the s string." Please advise.


#9

Please show us your code, again. Thanks.


#10

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


#11

Hey @dio123,

To clarify the syntax,

name = "Mike"
print "%s" % (name)

From above you can see that the %s in the double quotes will be replaced by what follows after the % and inside the parentheses.
The output for above would be :

Mike

So for this exercise you would need to replace all ___'s (3 underscores) inside the double quotes with a %s. And the ___'s (3 underscores) outside the double quote with %.
So the final output should display

Ah, so your name is myname, your quest is myquest, and your favorite color is mycolor.

Hope this clarifies your doubt.


#14

after submitting, its hanging for ever


#15

How long should i wait after submiting


#16

Assuming your code is correct it shouldn't be any time at all. Please post your code, any error messages, and a link to the actual exercise. Thank you.


#17

What is your name?

this is what i get when i replace the underscores with %s and %


#18

Still could use a link to this exercise. We need to be on the same page.


#19

i have been on this all day. my very first time to program.
i really need help


#20

Is this the exercise you are working on?

https://www.codecademy.com/en/courses/python-beginner-sRXwR/3/4


#21

yes. that is the exercise


#22

Post your code please :slightly_smiling: