String formatting with %, part 2. help needed


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>

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))

It’s throwing error

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).

Please help


#2

Hi @itig,

Your code works when I submit and run it.

Refresh the page and run it again. Let us know what happens.


#3

its giving me the same error after so long of not typing in the console window. the issue is that its not letting me type in the console window after i run the code


#4

I’m having exactly the same issue…


#5

Codecademy staff, please note …

If refreshing the page does not enable valid code to work properly, it is a bug in the system. Codecademy staff read the forums and are aware that some users are having this type of problem. We look forward to having this issue resolved.


#6

I figured out the issue. I was using Google Chrome. I switched to Mozilla Firefox browser and it worked fine.


#7

Hello, Is there no other solution than to change the browser to Firefox?


#8

This code doesn’t work for me neither on Chrome or Firefox.
I get either the original poster’s error text, or this:

What is your quest?What is your favorite color?Ah, so your name is RUN, your quest is name = raw_input(“What is your name?”), and your favorite color is quest = raw_input(“What is your quest?”).


#9

Same here ! :persevere:


#10

I was getting the same error, update my Chrome browser… and VIOLA! It now works.
Interesting to note that the variable for raw_input is used in Python2 if you have to do it in Python3 you have to set the variable to input("What is your name? "). Tested our using Atom.


#11

I changed my browser from google chrome to safari and it worked!


#12

Your code is right.
When you click “run”, right window should pop up questions, and then you just answer it.
It means you actually run the code and complete the practice.
On chrome and Firefox, I got the same problem but not in Vivaldi


#13

I removed “raw_input”, and then the script worked.

name = "What is your name?"
quest = "What is your quest?"
color = “What is your favorite color?”


#14

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).

Same error I went to https://repl.it and ran it and works just fine.


#15

raw_input is legacy Python… Avoid it if possible.

It is possible you were using Python2 instead of Python3 on repl.it, which would be why it worked.


#16

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