Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics Functions and Looping Create a Function

AssertionError: 5 != 1 :

def square (number):
    return number * 5

1 Answer

Steven Parker
Steven Parker
221,900 Points

The message may be a little confusing, but the instructions asked for a function that would square the passed argument, but that's not what this code is doing.

One way to calculate a square would be to multiply the value by itself, but multiplying by 5 would only create a square if the argument was also 5 (and the tester obviously tries other values).

i still didn't get it i am new to programming.

Steven Parker
Steven Parker
221,900 Points

You can't use "5" because that would only work if the argument was 5. To get a square, you must multiply the number by itself (so instead of "number * 5", you might write "number * number").