This forum is now read-only. Please use our new forums at discuss.codecademy.com.

269 points
532731a8282ae358c1000a00_142735698
Submitted by
saiavinash
over 5 years ago

Why this is not working in Python 3.4?

a=rawinput("What is ur name")
Traceback (most recent call last):
File "", line 1, in
a=raw
input("What is ur name")
NameError: name 'raw_input' is not defined

What does it mean..??


1 vote

permalink

In Python 3.x, input() replaces raw_input(), for input from the console. It returns the user's response a string, so when an int or a float is needed, it is necessary to convert the returned value from the str type using int() or float(). Also remember to use the print() function with Python 3.4, including parentheses, for output to the console, instead of the old print command that did not require parentheses.

17437 points
542ea68c9c4e9de17e00010c_599561501
Submitted by
Glenn Richard
over 5 years ago


1 vote

permalink

for python 3.4 (which is what i use) we no longer use "raw_input" instead we just do "input" so the code would look something like this:
a = input("What is your name")

661 points
4da255af5e8184aebbc4e695b83d7e1e?s=140&d=retro
Submitted by
Thomas Rehnert
almost 5 years ago