[Solved] File “”, line 1, in NameError: name ‘ ‘ is not defined in ATOM [duplicate]

It’s weird because my code works fine in online python interpreter but when I run it in linux mint with Atom, I have this error message when I enter a word:

File "<string>", line 1, in <module>
NameError: name 'lol' is not defined

Here is my code

# -*- coding: utf-8 -*-

word = str(input(" Enter a word : "))
reverse = word[::-1]
if reverse == word:
  print("it is a palindrome, félicitation : ")
  print(" it is not a palindrome : ")
Enquirer: mrNicky


Solution #1:

Try using raw_input instead of input. It sounds like in the online interpreter you might be running the code in Python 3, in which input behaves like Python 2’s raw_input, and using Python 2 locally.

In python 2, input results in your code looking for a definition for your input, rather than taking it as a string.

Respondent: samwalton

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy