FAQ: Learn Python – Strings & Console Output – String Formatting with %, Part 2

This community-built FAQ covers the “String Formatting with %, Part 2” exercise in Codecademy’s lessons on Python.

FAQs for the Codecademy exercise String Formatting with %, Part 2:

Join the Discussion. We Want to Hear From You!

Have a new question or can answer someone else’s? Reply (reply) to an existing thread!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources about Python in general? Go here!

Want to take the conversation in a totally different direction? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account, billing, Pro, or Pro Intensive? Reach out to our support team!

None of the above? Find out where to ask other questions here!

Other FAQs

The following are links to additional questions that our community has asked about this exercise:

  • This list will contain other frequently asked questions that aren’t quite as popular as the ones above.
  • Currently there have not been enough questions asked and answered about this exercise to populate this FAQ section.
  • This FAQ is built and maintained by you, the Codecademy community – help yourself and other learners like you by contributing!

Not seeing your question? It may still have been asked before – try searching for it by clicking the spyglass icon (search) in the top-right of this page. Still can’t find it? Ask it below by hitting the reply button below this post (reply).

8 posts were split to a new topic: What is raw_input()?

2 posts were split to a new topic: What’s the Use of raw_input?

2 posts were split to a new topic: Why is There a Backslash Here?

print "Ah, so your name is ___, your quest is ___, "
“and your favorite color is ___.” ___ (name, quest, color)
please explain this piece of code

We want to print a string, in this string we want to use variables.

when running the script. I’m assuming the raw_input() function, is the one that require you to answer the question first before going to the next question?

is that right?

yes, raw_input prompts you for input, which you need to fill in, before the code continues to the next line

1 Like

Great! Thank you for the response!

Is the print string not suppose to show what is entered in the raw input field? I was getting the same issue even during the solution.

raw_input prompts you for input while the program is running, if you don’t enter something, the output will be blank (as you can see)

what is your name (and the other two) are only there to help the user using your program (you in this case) to determine what they should input

In the line 5, I cannot understand the use of “” in the print statement …
can anybody please expalin???


In line 5 why are we using back slash () and not plus(+) ???
On replacing it with plus it says syntax error…
WHY?

the backslash allows you to put the code over multiple lines

What is wrong with the code that is making it run the 2nd and 3rd prompt at the same time? This is perhaps an error in the original code provided.

1 Like

I am also experiencing this behavior. Could we please escalate this issue?

So I replaced all the “____” with %s as intended but when I click run it times out after asking for name. Seems like maybe a problem on CA’s side? I can’t find a syntactical issue and plus, it appears to be having the issue when taking the raw input which I did not change. I’m on windows and using chrome.

Yeah, Codecademy is having a lot of trouble with this right now :smiley: Everyone is reporting this happening. I suggest submitting a bug report.

ah ok. Where do I go to do that?