Skip to content

Latest commit

 

History

History
7 lines (4 loc) · 661 Bytes

functions_practical.md

File metadata and controls

7 lines (4 loc) · 661 Bytes

Functions practical

  1. Let's first create a function f_to_c, which converts temperature from Fahrenheit to Celsius. The formula is as follows: temp_c = (temp_f - 32) * 5 / 9. Test your function - f_to_c(32) should give output of 0.

  2. Then let's create another function c_to_k, which converts temperature from Celsius to Kelvin. The formula is as follows: temp_k = temp_c + 273.15. Test your function - c_to_k(0) should give output of 273.15.

  3. Using the two functions above, write one line code that converts temperature of 32 in Fahrenheit to corresponding temperature in Kelvin. Hint: think about "nesting" one function inside another one.