raw_input not defined | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

raw_input not defined

I am trying to create a program that would require user input in the console using raw_input, but when I use it like so: raw_input = ("Enter your age") It returns the error "raw_input not defined" Can someone please explain how to use raw_input? Thank you so much :)

7th Nov 2017, 4:37 PM
Nitay Eshed
Nitay Eshed - avatar
5 Answers
+ 6
raw_input() is a Python 2 command, for Python 3 (implemented in Sololearn's Code Playground) the right command is input()
7th Nov 2017, 6:12 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 6
Dunno about codecademy, but yes, input is equivalent to raw_input and it's a console input command. If the course you attend mentions raw_input extensively, it is sure in Python 2.
7th Nov 2017, 7:11 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 2
what version of python are u using? because depending on what version u are using this may not work if u are using the 3.4 or newer python version than u can do just this name = input("enter a name ")
7th Nov 2017, 6:00 PM
jay
+ 1
Thanks everyone. I am also learning on Codecademy. is that in Python 2? Anyway, is input() a console input command?
7th Nov 2017, 7:07 PM
Nitay Eshed
Nitay Eshed - avatar
0
thank you so much
7th Nov 2017, 7:50 PM
Nitay Eshed
Nitay Eshed - avatar