Python: Exercise 15. String Formatting with %, Part 2

python
community

#1

Okay so ive tried this multiple times and im to the point im wondering if its a glitch in the website or something. The code I put in says

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)

and when I run it it comes back with THIS

What is your name?What is your quest?What is your favorite color?Ah, so your name is SCT, your quest is if type(error) == ValueError:, and your favorite color is return "Make sure to use a lowercase \"s\" with \%s. Python told us about the following error: " + str(error).


#2

What happens if your use hard coded strings? (Comment out the input statements.)


#3

Could you illustrate more ?
what did you type? and Is this exactly what appeared on editor window ?


#4

I also have a problem with this question. https://www.codecademy.com/courses/learn-python/lessons/strings--console-output/exercises/string-formatting-with--part--1?action=resume

I used the same input code as webslayer68599, but in the console I get the second two questions printing together:

What is your name? Harry
What is your quest? What is your favorite color? To find Ron, scarlett
Ah, so your name is Harry, your quest is Harry, and your favorite color is To find Ron scarlett.

How can you get the questions to print separately in the console?


#5

Try a page refresh, and failing that, a different browser. If still no go, then enter the values manually in the code and comment out the input lines.


#6

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