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
173,603 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
173,603 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").