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 trial

Python Python Basics Functions and Looping Create a Function

need help with the squaring.py coding challenge

it sends me an eof on line 4 and can't figure out whats wrong.

squaring.py
def square (number):
    return number*number

number = int(input("what number you want squared?   "))
number_squared = square(number)         
print('the square of that is {}'.format(number_squared))

2 Answers

Hi Moises

Not sure whether you are stuck at challenge task 1 or 2 but here's some help:

Challenge task 1 of 2: Here only two rows suffice.

def square (number):
    return number * number

Challenge task 2 of 2:

def square(number):
    return number * number

# storing the value from the function call to variable named 'result'
result = square(3)

# print out the result
print(result)

Hope this helps!

Why did we have to use the hashtags? What in the prompt should have signaled that as a requirement? Because I got the code correct, but didn't have any of the hashtags/instructions.

Hello David

Those hashtag lines are comments in Python. I just added these comments for a fellow student who asked for help on this assignment so he could understand better what each of the lines in the code is doing. No requirement to use these in the challenge.