Python Homework #1

 

Create the functions below in a single file and upload that file to the homework server.

Exercise #1:
Create the function fahr_to_cel(temp) which will return the temperature in Celsius, given the temperture in Fahrenheit.
Example usage:
print('Freezing point of water is: ',fahr_to_cel(32), 'and the boiling point is: ',fahr_to_cel(212))
print('The temp in Celsius at -40 degrees Fahrenheit is: ',fahr_to_cel(-40))

Exercise #2:
Create the function dist(x,y) which will be given the coordinates of a point in the plane (x and y) and return the distance from the origin.
Example usage:
print('This should be 5: ',dist(3,4))

Exercise #3:
Create the function eval_quad(a,b,c,x) that will calculate the Y value given the coefficients a, b, c and the value of x of the equation Y = aX2 + bX + c.
print(eval_quad(1,1,1,2)) should print 7
print(eval_quad(0,2,1,4))  should print 9