Learn to Code via Tutorials on Repl.it!

← Back to all posts
How to get an input accept words and letters instead of just numbers
STCollier

In Python 2.7, it can be extremely frustrating (at least for me) to have something such as

noun = input("Insert a noun: ")

and when you run the program, and error message shows up. This is because the input will only accept numbers. In order to have the input accept anything, so in this case letters (and even symbols), you must change the "input" to "raw_input" and all your problems will be fixed. So the fixed code from the following example will look like this:

noun = raw_input("Insert a noun: ")

Hope this helps anyone.

Voters
STCollier
Comments
hotnewtop
hg0428

hg0428

That was fixed in python 3

STCollier

@hg0428 I literally just started programming when I wrote that comment, so I was kinda dumb lol

hg0428

I never even learned python 2.
I made a lot of dumb posts and videos when I started.
@STCollier