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

squaring

The third line might not be needed to complete this Task but I have no clue what it is I'm missing.

squaring.py
def square(number):
    return number * 2
square(5)
Manuel Canario
Manuel Canario
1,458 Points

def squareanumber(number): squared = int(number) * int(number) print("{} squared is {}".format(number,squared))

number = input("What number would you like to square? ") squareanumber(number)

This was my funtion and the program mark it as an error. I ran it in the workspace and the function is working.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

Manuel Canario, in input function can not be used in most challenges because the checker will only call the function directly and will not provide a response to the input prompt. Also be sure the function name matches what is asked for in the challenge. Good luck!!

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

You are doubling the number, not squaring it. To square it use a double asterisk: **

wow.... I can't believe I made that mistake. Thanks!

Manuel Canario
Manuel Canario
1,458 Points

What about the 0 the computer is saying that I did not validate my program of 0.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

Manuel, I suggest starting a new post and include your code. Tag me in the post if you wish.