String Formatting with %, Part 2


#1

I replace the ___ with %s on this exercise and the final %, but every time I hit “Run” the exercise freezes and won’t load.

I followed the directions exactly, and I left the code below to what it wants. I’m not entirely sure why it freezes.



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



#2

Did you get the user input for the three variables?


#3

I assume you mean the


name = raw_input("What is your name?")
quest = raw_input("What is your quest?")
color = raw_input("What is your favorite color?")

I tried leaving that alone, and changing what was in the " " but either way it freezes.


#4

When you Run the code, are you providing the inputs when prompted?


#5

I see what you mean now, I wasn’t utilizing the console to answer the questions. Thanks for your help.


#6

When I do it, it doesn’t give me time to enter in answers. The first question pops up and as soon as I press a button, it gives me an error.


#7

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

^that’s what it tells me.


#8

I’ve run this page in Firefox a couple of times, now, with no issue.

https://www.codecademy.com/en/courses/learn-python/lessons/strings--console-output/exercises/string-formatting-with--part--1

What browser/OS are you running?


#9

I’m using Chrome and Windows 10.


#10

So far I haven’t had any other issues with later lessons, but nothing has had raw input again (not yet anyway).


#11

Actually I’m having a similar issue with the Go With the Flow lesson in Conditionals & Control Flow. It acts as if I hit enter over and over again in the console.


#12

Do you have Firefox? Have you tried IE (Edge)?


#13

Does seem to be a Chrome error - I had multiple issues in Chrome, like two of the questions combining in the output so the answers didn’t work properly, the console not recognising anything I typed, and the whole thing freezing on an endless loading screen, but typing in the exact same thing, the output works fine in Firefox.

The "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).” happens if you don’t replace the blanks in the exercise and just submit it as is.


#14

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