Python Python Basics Functions and Looping Create a Function

Splotch_ P
PRO
Splotch_ P
Pro Student 2,657 Points

I am having a hard time storing the value of the squared number as a result.

If anyone can show me a fast way to write this correctly I would really appreciate it

squaring.py
def square(num):
    print (num * num)
Splotch_ P
Splotch_ P
Pro Student 2,657 Points

Thank you for the responses. I figured out that I wasn’t storing the square of 3 as a result after passing in the arguement.

2 Answers

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,192 Points

The challenge specifies the parameter name is "number" but I think it works either way.

def square(number):
    return (number * number)

You need to return, not print.

print just prints data onto the screen, but return allows you to return the data for further processing.