Python Python Basics Functions and Looping Create a Function

Anmol Gulati
Anmol Gulati
8,268 Points

Create a function named square. It should define a single parameter named number. In the body of the function, return
def square(number)
return number*2
number = 5
print (square)

1 Answer

Steven Parker
Steven Parker
160,421 Points

The value being returned here is the number times 2 instead of the number squared. The exponent operator has two asterisks ("**"), or you can multiply the number by itself as you did later. And to be considered part of the function, the "return" statement must be indented.

Also, you don't need any of that code following the function for the challenge.