#Quiz03 Square Root, Cube Root

Functions

For this quiz I want you to (in class) create a program with two functions:

  • def square_root(x):  // returns the square root of x (float)
  • def cube_root(x): // returns the cube root of x (float)
  1. You need to write “from math import sqrt” : it means you can import functions from the math module.
  2. A function is a named sequence of statements that performs a computation.

When you define a function, you specify the name and the sequence of statements. By writing “def square_root (x)”. Then your function will return a result: it is called the return value.

def : indicates that it is a function definition

square_root : is the name of the function

(x): x is the argument of the function

Return is what comes out of my function.

Leave a comment