What am I doing wrong?
Can some one please help creating this function please?
def square("value * value") Vaule = 5 square("5 * 5 = 25") print("25")
KRIS NIKOLAISENPro Student 47,480 Points
A basic function looks like this:
def function(parameter): do something return value
The instructions for the challenge are: Create a function named square. It should define a single parameter named number. In the body of the function return the square of the value passed in
So the function called square with a single parameter called number would be
From here it has to do something - in this case square parameter number
value = number*number
So that value can be used outside the function you need the return statement
put together is
def square(number): value=number*number return value
which can be shortened to
def square(number): return number*number