Skip to content

Instantly share code, notes, and snippets.

@pamelafox
Created August 26, 2021 17:17
Show Gist options
  • Save pamelafox/6ced4d353e229bc01f7d5b0820472b28 to your computer and use it in GitHub Desktop.
Save pamelafox/6ced4d353e229bc01f7d5b0820472b28 to your computer and use it in GitHub Desktop.
Temperature converter
"""
How can we communicate the highs and lows of climate change with people who use a different temperature unit?
Let's make a temperature converter based on the steps here:
https://www.mathsisfun.com/temperature-conversion.html
Create a function called celsius_to_fahrenheit that:
* takes a single argument, the temperature in celsius
* calculates and returns the fahrenheit equivalent
Similarly, create another function called fahrenheiht_to_celsius that:
* takes a single argument, the temperature in fahrenheit
* calculates and returns the celsius equivalent
"""
# This def statement may be incomplete...
def celsius_to_fahrenheit():
"""
>>> celsius_to_fahrenheit(0)
32
>>> celsius_to_fahrenheit(100)
212
"""
# YOUR CODE HERE
# This def statement may be incomplete...
def fahrenheit_to_celsius():
"""
>>> fahrenheit_to_celsius(32)
0
>>> fahrenheit_to_celsius(212)
100
"""
# YOUR CODE HERE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment