Q:

Python unexpected EOF while parsing. Problem inputing a math operator

Thank you all for your help and time. It seems it was my own issue. When I ran the code I was running it using Python 2 instead of 3. My apologies.
I am in the process of learning some python basics and came across this error while trying to code a simple calculator. The code I have below is test code I found on GitHub and should work fine. However, I am getting an error every time I have the user input their specific operation. For example 1. I start my code, 2. I input a number, 3. I input the operation (i.e. +, -, *, /) and then my code breaks. 
I am using Atom and a Terminal package that allows me to run scripts from within Atom using the terminal. If I were to type "+" instead of + the code would then continue and perform how I want it to. I am still very new to python so maybe the fix is trivial.
num1 = input("Hello, What is your First Number?\n")
operation = input("Operation?\n")
num2 = input("Your Second Number?\n")

floatnum1 = float(num1)
floatnum2 = float(num2)

if operation == "+":
    output = floatnum1+floatnum2
if operation == "-":
    output = floatnum1-floatnum2
if operation == "*":
    output = floatnum1*floatnum2
if operation == "/":
    output = floatnum1/floatnum2

print("Your Answer: "+str(output)) 

Here is the error:
python simplecalctest.py
Hello, What is your First Number?
2
Operation?
+
Traceback (most recent call last):
  File "simplecalctest.py", line 2, in <module>
    operation = input("Operation?\n")

  File "<string>", line 1
    +
    ^
SyntaxError: unexpected EOF while parsing

And here is what it looks like if I input "x":
python simplecalctest.py
Hello, What is your First Number?
2
Operation?
"+"
Your Second Number?
2
Your Answer: 4.0

I would like to simply input +, -, *, and / without having to put them in "x". Any help would be greatly appreciated!

A:

The issue is that you are evaluating the user's input as code, rather than keeping the input as a string. You do this when calling eval on the input. The input function returns input from a user as a string and eval takes a string and executes it as code.
So if, for example, a user enters the plus character + on its own, your code will basically run as:
operation = +

Which is not valid Python code.
The reason your code works if the user enters the plus character in quotes "+" is because then your code will run as:
operation = "+"

Which is valid code.
You can fix this by changing:
operation = eval(input("Operation?\n"))

to
operation = input("Operation?\n")

Also in general, you should not blindly evaluate user input because it might be dangerous.

