+ 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 :)
5 Antworten
+ 6
raw_input() is a Python 2 command, for Python 3 (implemented in Sololearn's Code Playground) the right command is input()
+ 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.
+ 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 ")
+ 1
Thanks everyone. I am also learning on Codecademy. is that in Python 2?
Anyway, is input() a console input command?
0
thank you so much