0

I built a very simple addition calculator in python:

#This program will add two numbers entered in by the user print "Welcome!" num1 = input("Please enter in the first number to be added.") num2 = input("Please enter in the second number to be added.") sum = num1 + num2 print "The sum of the two numbers entered is: ", sum 

I haven't setup python yet, so I'm using codepad.org (an online compiler).

I get the following error:

Welcome! Please enter in the first number to be added. Traceback (most recent call last): Line 5, in <module> num1 = input("Please enter in the first number to be addeded.") EOFError 

3 Answers 3

7

The problem is that, while codepad will run the code for you, it doesn't give you any interactivity (the program fails when it prompts for input, and codepad can't give it any input, so it gets an error). See https://web.archive.org/web/20120104164315/http://pyref.infogami.com/EOFError for a more thorough explanation of the error.

You really need to just go ahead and install Python and work with it from your local machine. http://www.python.org/download/

Oh, and good luck learning Python!

Sign up to request clarification or add additional context in comments.

1 Comment

Oh ok. I was downloading python while trying to compile the code, now that its finished I'm gonna go ahead and install it. Thanks!
3

Use ideone where you have special input frame. Yes still no interactivity but convenient stdin. You will need just type your numbers in there.

Comments

-1
print("Welcome To My Calculator") num1 = int(input('Enter First Number: ')) num2 = int(input('Enter Second Number: ')) Sum = 'num1 + num2' print ('Your Answer is: ' + str(num1+num2)) 

Output:

Welcome To My Calculator Enter First Number: 20 Enter Second Number: 10 Your Answer is: 30 

1 Comment

The question was about the EOFError when running the Python code in codepad.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.