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

6 Answers

diogorferreira
diogorferreira
19,362 Points

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

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

def square(number): return number ** 2

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

Richard Thomas
Richard Thomas
3,028 Points

0/10 task for teaching

Jack Kussmann
Jack Kussmann
1,033 Points

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

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