0

I am using the SublimeREPL package in Sublime Text 3 to create a compatibility calculator between two individuals. My program relies on user input as the main source of material, but every time I try to run a simple code that asks for a text input, such as:

a=input("What is your name? ")
print(a)

When I type in my name, Omar, with no quotations, it will result in this NameError:

Traceback (most recent call last):
  File "test2.py", line 1, in <module>
    a=input("What is your name? ")
  File "<string>", line 1, in <module>
NameError: name 'Omar' is not defined

This code works however, if the text input is in quotations. However, for my purpose, it is incredibly inconvenient to have to insert quotation marks around the text that the user types every single time. I have seen videos where this worked with other people, and frankly, I'm stumped. If anyone knows what to do to make this work, or an alternative solution to this, please let me know. Any answers will be greatly appreciated.

Omar D.
  • 1
  • 1

2 Answers2

0

This works in Python 3 - see https://repl.it/repls/RespectfulWoozyFactorial.

I would verify that your version of SublimeText is indeed using Python 3. You could do this by invoking some iteration of python --version using the Sublime REPL.

alex
  • 6,818
  • 9
  • 52
  • 103
0

It’s possible you did not leave any white space before and after the = mark. I get the same error when I use the exact code you gave us but after adding a space before and after the = it works just fine.

cokeman19
  • 2,405
  • 1
  • 25
  • 40