Open main menu

CDOT Wiki β

Changes

OPS435 Python Lab 3

209 bytes added, 10:30, 31 May 2017
PART 2 - Providing Functions With Arguments
def square(number):
return number ** 2
</source>FYI:#To square a number in math your multiply using '''number * number''' or use exponents '''number ** 2''' to the power of two. This function takes one argument '''number''', the function will use exponents to multiply the number given by itself.You should notice that the square of the number sent up to the function is returned to the main program (in our case, the ipython3 shell).<br><br>:#Issue the following to test your '''square()''' function:<source>
square(5)
square(10)
13,420
edits