Skip to content
Snippets Groups Projects
Commit c83e7cf7 authored by cprutean's avatar cprutean
Browse files

Upload New File

parent 69c4a980
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:74c83032 tags:
# Temperature Converter
%% Cell type:code id:e7d790d3 tags:
``` python
"""
Simple converter between Fahrenheit and centigrade using functions
"""
def fahrenheit(t):
"""
Convert centigrade to fahrenheit
"""
return 1.8*t + 32
def centegrade(t):
"""
Convert fahrenheith to centegrade
"""
return (t - 32.0)/1.8
def main(): # Main program
freezing = 0.0
boiling = 100.0
print("Water freezes as : " + str(freezing) + " C or " + str(fahrenheit(freezing)) + " F")
print("Water boils as : " + str(boiling) + " C or " + str(fahrenheit(boiling)) + " F")
normalbody = 98.6
deathvalley = 134.0
print("Normal body temperature is : " + str(normalbody) + " F or " + str(centegrade(normalbody)) + " C")
print("Death Valley record is : " + str(deathvalley) + " F or " + str(centegrade(deathvalley)) + " C")
main()
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment