Start with Python
This commit is contained in:
14
1- python/9a-temperature-converter/README.md
Normal file
14
1- python/9a-temperature-converter/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
Temperature Converters
|
||||
======================
|
||||
|
||||
#### Fahrenheit to Celsius
|
||||
Write a function that converts fahrenheit temperatures to celsius. The equation to do this is ```C = (F - 32) * 5/9```.
|
||||
|
||||
#### Celsius to Fahrenheit
|
||||
|
||||
Write a similar function that converts celsius to fahrenheit.
|
||||
The equation for this is ```F = (C * 9/5) + 32```.
|
||||
|
||||
#### Testing
|
||||
|
||||
Make sure the tests pass. Write 3 of your own tests.
|
12
1- python/9a-temperature-converter/temp.py
Normal file
12
1- python/9a-temperature-converter/temp.py
Normal file
@ -0,0 +1,12 @@
|
||||
def fahrenheit_to_celsius(temp):
|
||||
pass
|
||||
|
||||
def celsius_to_fahrenheit(temp):
|
||||
pass
|
||||
|
||||
|
||||
assert(fahrenheit_to_celsius(32) == 0), "Freezing temp should return true"
|
||||
assert(fahrenheit_to_celsius(212) == 100), "Boiling temp should return true"
|
||||
assert(fahrenheit_to_celsius(-13) == -25), "Negative number should return true"
|
||||
assert(celsius_to_fahrenheit(37) == 98.6), "Body temp should return true"
|
||||
assert(celsius_to_fahrenheit(10) == 50), "Random temp should return true"
|
Reference in New Issue
Block a user