Python

0 Dal Gurung · January 4, 2015
Hey! Bucky I have a problem with IDLE while executing a command such as: 
x = raw_input ("Enter name: ")
print "Hey " + x


It gives me Traceback(most recent call last):
File "C:\Python34\EnterName.py", line 1, in <Module>
x = raw_input ("Enter name:")
NameError: name 'raw_input' is not defined.


What could be the problem? Need help.


Thanks
Zambie

Post a Reply

Replies

Oldest  Newest  Rating
0 Chris Nelson · January 4, 2015
What version of python are you running? I believe in 3< raw_input was dropped in place of just input so..

x = input("Enter name: ")
print ("Hey" + x)

Then from there you can use either str or int to define what was enter so in this case, since your name is not a number it might be best to say..

x = input("Enter name: ")
x = str(x)
print ("Hey" + x)
  • 1

Python

107,222 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator