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

Shahla Jalali
Shahla Jalali
589 Points

create a function named square

Create a function named square---

what is the answer?

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

answer_due = float(input("What is the square of? "))

square_is = square(number)

print("The square of {}".format(square_is))

1 Answer

The square function should return the number times itself. You are returning the number times 2.

The code below the function shouldn't be included in the challenge. But for testing purposes

square_is = square(number)

should use the variable you created that stores the input

square_is = square(answer_due)