IFT 194 CH 8.2

profilefoooq55

       

Do parts A, B, C below

 

This is a short brush up on some simple math that will then be converted into Python functions.

 

 

 

Scenario: You are to write two functions, one  that will convert from Celsius degrees to Fahrenheit,  and a second python function that converts Fahrenheit to Celsius. I will work through the first one with you.

 

 

 

 

 

 

 

 

 

To figure out (straight line) connection between Celsius and Fahrenheit, you can use two the pieces of data that you already know. Remember, all you need to determine a straight line is two known points. And, you already know these… :-)

Since the connection between Fahrenheit and Celsius is a straight line, the

equation of a straight line, using these concepts is:

F = a + b * C

where a is the intercept and b is the slope

What is the intercept?? , well just look at the diagram→ when C =0, then F = 32, so the intercept is 32 ( i.e. ‘a’)

What is the slope ( rise over run)  ( 212 – 32 ) / (100 -0)= 180/100   = 1.8 , this is your ‘b

So,

F (degreesF) = 32 + 1.8 C(degreesC)

A. Now construct a python function to calculate F, where the parameter of the function is the ‘C’ value and the return from the function  is the ‘F’ value.

     Use your function to calculate and include in this document the F value , when C = 13.65

 

B. Now draw another diagram with the horizontal axis being F and the vertical axis being C.

   a). Draw the two known points and then draw the line between them.

   Now, what are these  ‘a’ and ‘b’,  since now you want C in terms of F.

 C. Construct the python function to calculate the degrees Celsius, given the degrees     Fahrenheit.

    c)    Use your function to calculate and include in this document the C value , when F     = 13.65

 

 

 

    • 7 years ago
    • 10
    Answer(1)

    Purchase the answer to view it

    blurred-text
    NOT RATED
    • attachment
      convert_celsius_to_fahrenheit.docx