Computer Studies‎ > ‎Python‎ > ‎

Functions Assignments

Create a python file with the following defined functions, each using the doc test method shown here. Submit to the appropriate handin folder.

def convert_to_celsius(fahrenheit)
    returns the Celsius equivalent of the Fahrenheit temperature
def convert_to_fahrenheit(celsius)
    returns the Fahrenheit equivalent of the Celsius temperature
def quadratic(a, b, c, x)
    returns ax2+ bx + c
def absolute_value(n)
    returns the absolute value of n
def triple(n)
    returns n * 3
def convert_to_miles(km)
    returns the number of miles given the kilometres
def convert_to_km(miles)
    returns the number of kilometres given the miles
def avg_of_three(a,b,c)
    returns the average of a, b, and c
def avg_of_top_three(a,b,c,d)
    returns the average of the top 3 of a, b, c, d (using avg_of_three(), above)