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

Yaron Attar
Yaron Attar
9,738 Points

function

I'm on this task for two days.. Please can anybody find out what it wrong with my code?

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

number_of_user = float(input("What is your number?   "))
square_number = square(number_of_user)
print ("the square of your number is {}", format(square_number))

1 Answer

Rohald van Merode
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Rohald van Merode
Treehouse Staff

Hey Yaron Attar 👋

When working on these kind of challenges you'll want to strictly do what it's asking, the bottom three lines in your snippet are not required for the challenge and may even cause the test to fail 🙂

Your square function looks great and task one should work as expected after removing those three lines 😃!

For the second task in this challenge you'll want to call the square function and store the returned value in a variable named result.

I hope this helps you to get going again! If not let me know and I'd be happy to elaborate 🙂