CS 61A

Structure and Interpretation of Computer Programs, Spring 2015

Instructor: John DeNero




Question | Function Introductions

Define temperature_converter, which takes a temperature in Fahrenheit, f_temp and returns the same temperature, but in Celsius.

The equation for converting from Fahrenheit to Celsius is:

  1. Temperature in Fahrenheit - 32
  2. Times 5
  3. Divided by 9.
def temperature_converter(f_temp):
    """
    >>> celsius_temp1 = temperature_converter(32)
    >>> celsius_temp1
    0.0
    """
    ## YOUR CODE HERE ##
def temperature_converter(f_temp):
    return (f_temp - 32) * 5 / 9