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

Mark Nembhard
Mark Nembhard
1,387 Points

I am not sure where i have gone wrong in Python with this function test to square an inputed number. Seems simple enough

def square(number): square = number*number return square print (square(number)) number = int(input("what is the number to be squared"))

2 Answers

Steven Parker
Steven Parker
231,210 Points

If I remember the challenge correctly (a link to it would be helpful next time), it doesn't require you to print or input anything. I believe your task is only to define the function.

If you remove those extra parts (and don't have any indentation issues) you should pass.

And to display your code so the indentation shows, format it with the info in the Markdown Cheatsheet pop-up below the "Add an Answer" area. :arrow_heading_down:   Or for more detailed instructions, you can watch this video on code formatting.

Mark Nembhard
Mark Nembhard
1,387 Points

Steven. If you were a girl i would kiss you. Bloody worked first time. Moral. Don't speed read. Especially when programming