How do I use raw_input( )?


How do I use raw_input( )?


raw_input() is a method that prints what you put inside to the console, waits for the user to type something, and returns whatever they typed after the enter key is pressed. This is a common mistake:

raw_input(“Enter something here: “)
my_variable = raw_input()

This doesn’t work because raw_input() is a method, so it’s simply going to use it each time you write it. By writing it by itself on the first line above, it just performs the method and moves on in the program to the next line without having assigned that value anywhere. Then on the second line, it runs raw_input() again, but with no prompt, so the user is just met with a blinking cursor and won’t know they’re being prompted for input.

The instructions show a great example of using this method properly to store the user’s input into a variable: name = raw_input("What's your name?").


NOTE: We’re using Python 3.0, so that you should type code like this:

car = input(“Type your are name: “)
print (“car”)

if you will type “Lambo” in Type your car name the result will be:


not really? You print string car, not the variable (which contains value entered by user)

but its indeed true, the input functions changed in python3


This is still a little confusing to me. What’s the point of having the program take input twice if only the one with the variable matters anyways? Is this answer saying the second line with the variable must have a “prompt” for raw input? If that’s the case then why isn’t the solution to the program simply

original = raw_input("Enter something here: ")

Why are we told to do the first raw_input(“Enter something here:”) if it doesn’t matter in terms of saving the input results as a variable. Why not just have one line of code to ask for the input and save it as a variable from beginning?


or even:

print "enter something here: "
my_variable = raw_input()

if you want the user to type below.

Don’t overthink it, the FAQ feature is still work in progress, its fine as long as you understand what raw_input does

Something odd is happening with the piglatin exercises . I put in the correct code and it just keeps on giving an ‘X’ in the instruction pains

I even copy the solutions code and re-enter it and that still comes out as an error


Could be a glitch, it happened before. Can you continue by getting the solution until its fixed?

No problem. i will carry on

I have the exact same glitch, so how did you fix it , or did it fix itself??

1 Like

Taking solution as shortcut you will see there are not a blank space between : and "
the class instruction has a typo, if you copy that literally you will fall in the glitch.
try typing raw_input(“Enter a word:”)

I also am receiving the fail error, shown as:

Traceback (most recent call last):
File “python”, line 4, in
ExecTimeoutException: Program took too long to terminate.

I’ll continue, but I hope it gets fixed.


Hey @coursemaster60546! Everyone else is having this problem as well. I recommend submitting a bug report.

1 Like

I found the solution, based on the hint. You have to click in the console window on the right hand side before you start typing in it. Otherwise the program doesn’t get an input and eventually times out.


Something odd is happening with the piglatin exercises . I put in the correct code, but the console won’t display the type word.

Problems with the raw_input function? What if you run your code on

Hi, I had a similar error. ruadh495 provided the solution - after you click on ‘Run’, navigate the mouse to the console to the right of the coding pain and left-mouse click while the mouse is in the console window/pane. Once the console is active (by left-mouse clicking on it) you can type in the word. You will also see the word appear as you are typing.


I’ve just submitted a bug report. When did you guys submit yours? Hopefully they won’t take too long to fix it

After two years and maybe some bug reports the exercise still does not work correctly.

You can try by yourself. I had to press the view solution thingy. I hope some day it will be fixed. Also as the comments above said keep in mind that in Python 3, raw_input() is replaced with input().

This worked !!! Thank you !!

I just solved why raw_input does not work.
After I hit run, I got the prompt, typed at keyboard, no response, fail
But when I took the cursor to where the input was being asked, (it was a letter sized box) and that box changed to a color box same size, I was able to enter letters, and have them count