Python Python Basics Functions and Looping Create a Function

create a function named square It should define a single parameter named number. In the body of the function, return..

...the square of the val that was passed in.

squaring.py

5 Answers

fodhil zidane
fodhil zidane
23,023 Points

def square(number): return number ** 2

So that did work, but why on this particular code was not second line needed.?

Jack Kussmann
Jack Kussmann
936 Points

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

fodhil zidane
fodhil zidane
23,023 Points

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

diogorferreira
diogorferreira
15,487 Points

It might be just me but there is nothing in the question?

fodhil zidane
fodhil zidane
23,023 Points

please, which second line you are talking about?

Sorry this was the question.. I guess I posted it wrong.

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 that was passed in. (A *square is the value multiplied by itself. eg: The square of 5 is 25. 25 = 5 x 5)*

This is my code: def suqare(number): value = number * number

Richard Thomas
Richard Thomas
3,028 Points

0/10 task for teaching