Exercise: Write a function that takes three numbers as arguments and return their product.
Exercise: Change the function so it only takes one argument, get another from the global scope, and assigns to a local variable for the last value.
Exercise: Write a function that takes two lists as its input and return the longest of the two.
Exercise: The distance between two points, (x1,y1)
and (x2,y2)
is √(|x1-x2
|²+ |y1-y2
|²). It follows from Pythagora’s Theorem (as you should be able to see using a small drawing). Write a function that computes the distance between two functions. You can use the sqrt()
function to get the square root, but you need to import it from the math
module first:
from math import sqrt