Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics (2015) Logic in Python Try and Except

My code worked earlier today and in python, but I now get an EOF error

What is wrong with this coding for the first trial.py exercise? def add (first, second): first=int(input("First number? ")) second=int(input("Second number? ")) return first + second

trial.py
def add (first, second):
    first=int(input("First number? "))
    second=int(input("Second number? "))
    return first + second

2 Answers

This question is misleading because it states that you have to solve the ValueLabel exception before the numbers are converted into floating point numbers. The correct answer does not correspond to the statement of the problem.

What happens in automated testing of your code is... your code is ran and a file with sample input is passed along. When the result matches the pre-calculated result, your code is accepted.

here you dont have to take the input from user. Just write the function and script will take care of it from its end.

def add (first, second):
    return first + second

Thanks Krishna, I had already gotten to the third problem earlier in the day, so I guess I jumped ahead of the game when I had to go back to the first question. In any case, I truly appreciate your input, and can now go on with the tutorial! Yeah!!! Bill