Python Python Basics Functions and Looping Create a Function

Fumihito Takanami
Fumihito Takanami
1,983 Points

what is the wrong this code?

squaring.py
def square(number):
    result = number ** 2
    return(result)

2 Answers

Daniel Turato
PRO
Daniel Turato
Java Web Development Techdegree Graduate 30,102 Points

Result is meant to be assigned outside of the function to a call of the square method. So your code would look like this:

def square(number):
    return number ** 2

result = square(3)