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

AssertionError: 5 != 1 :

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

1 Answer

Steven Parker
Steven Parker
229,920 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
229,920 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").