NameError: name 'raw_input' is not defined in ATOM

python_3

#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
pyg = ‘ay’

original = raw_input(‘Enter a word:’)

if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
new_word = word + first + pyg
new_word = new_word[1:len(new_word)]
print new_word
else:
print ‘empty’

<In what way does your code behave incorrectly? Include ALL error messages.>
If i go to ATOM and run the same code or if i go to a website where i can run python scrips online
i get the same error, why is this?
Traceback (most recent call last):

File “C:\Users\pigtranslator.py”, line 3, in
original = raw_input(‘Enter a word:’)
NameError: name ‘raw_input’ is not defined

<What do you expect to happen instead?>
to run smooooth

```python

pyg = ‘ay’

original = raw_input(‘Enter a word:’)

if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
new_word = word + first + pyg
new_word = new_word[1:len(new_word)]
print (new_word)

else:
print(“Empty”)

<do not remove the three backticks above>

#2

Hi @achilillador,

If you are using Python 3.x, you will need to replace raw_input with input in your program.

In Python 3.x, raw_input does not exist.


#3

Good to know @appylpye :yum:


#4