Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialomrlpzskdh
1,317 PointsEOF error, but the code works in other IDEs.
def square(number): return(number * number)
number_to_be_sq = int(input("What is the square root of? ")) number_sq = square(number_to_be_sq) print("The square root is {}".format(number_sq))
File "", line 4, in EOFError: EOF when reading a line
1 Answer
Tom Ireland
4,191 PointsHey, d3wrz . I'm fairly new to Python but thought I'd try and help out.
I copied and pasted your code, had a read through (all looked fine) and then tested it in the terminal. It works fine!
Where did you test the code? Can you try copy and pasting it again and enclose it in backticks?
The formatting is a little odd here (assuming copy and paste?).
Here is my formatting:
def square(number):
return(number * number)
number_to_be_sq = int(input("What is the square root of? "))
number_sq = square(number_to_be_sq)
print("The square root is {}".format(number_sq))
Output:
tomthebigtree@theirelandhousehold:~/Apps/Python$ python3 community.py
What is the square root of? 3
The square root is 9