If you see “What is your name?” printed to the terminal window on the right, then it’s just waiting for you to type your name, press enter, and then answer the next two questions in the same way. When it’s done taking input from you, it will display the string you’ve built and pass the exercise.
If you just see a black screen when you press Run, be sure that you’ve used string formatting correctly and if that doesn’t work, try these few steps:
Be sure to use Chrome, it’s typically the most reliable,
Clear your browser’s cache and press Cmd + Shift + R (Mac) or Ctrl + F5 (Windows),
Or check out our official troubleshooting guide
I would like to comment that this exercise is not working for me. I still do not understand it even after clicking to reveal the solution. I would very much appreciate a step by step from someone who did complete this exercise. I’m pretty sure I’m just overthinking it, but I can’t seem to get it right.
so this is my code
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)
This is also the code if you press solution, but It wont let me type in my quest it goes What is your name? and you answer your name, then it asks What is your quest?What is your favorite color? and I don’t understand why help would be amazing.
@chiprunner92338
To my understanding, when you put %s into the code, you are telling Python to substitute a string data type right there. Think of %s and substitute string. If you use %d you are telling Python that you want to substitute an integer decimal value. The % also converts data types, such as from decimal to string.
If you want to learn more, you can look at the link below. Yes, it talks about data types at first, but about half way down it talks about the substitutions.
The most simple and working solution with this issue I was able to find was to divide default code lines with empty line by presssing Enter. So, it must be like this:
1 name = raw_input("What is your name?")
2
3 quest = raw_input("What is your quest?")
4
5 color = raw_input("What is your favorite color?")
And if my following code is right - it works fine. Even after pressing reset button - works fine without changing the first three lines.
Don’t know why it worked, though.
Hey, this is late but the solution i found was to split the line for “your name is %s” and “your quest is %s” like below. For me, this solved the problem of the quest and colour questions appearing together.
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)
Personally I think it’s a bug with the raw_input. If you remove those sections and just force in strings, it will at least let you past. My code appears like this:
name = “Chris”
quest = “To find The Holy Grail”
color = “purple”
print "Ah, so your name is %s, your quest is %s, "
“and your favorite color is %s.” % (name, quest, color)
Thankfully the program doesn’t check to see if any of the upper section is correct, so it gives you the Next button once the output looks right.
Very true, but the point of the exercise is that you practice raw input. So bypassing it like that defeats the purpose. I guess if you have already solved the exercise then maybe but otherwise…
[My problem solved this way] Hey i got same problem when i click on run and when i write in output box it didn’t print anything but then again i did that and this time i select output box with a click and write into box and i got that.
Mine won’t even ask for my quest, it thinks for a while after I hit Enter after typing my name, then pops up with the error before showing anything else.