Advertisement
Guest User

Untitled

a guest
Feb 20th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Created on Tue Feb 20 20:40:22 2018
  5.  
  6. @author: EduardoP
  7. """
  8.  
  9. def fahrenheit(celcius):
  10.     f = celcius * 9/5 +32
  11.     return f
  12.  
  13. def kelvin(celcius):
  14.     k=celcius+273.15
  15.     return k
  16.    
  17. def rankine(celcius):
  18.     r=(celcius+273.15)*9/15
  19.     return r
  20.  
  21. def temperatures():
  22.     for celcius in range(-30,70,10):
  23.       print ('When the temperature is', celcius, ' celcius in Rankine the temperature is:',rankine(celcius),'In Kelvin it is:', kelvin(celcius),'In fahrenheit it is:', fahrenheit(celcius))
  24.     if (celcius>60 and celcius<-30):
  25.         print('sorry cant compute these values, try between 60 and -30')
  26.  
  27. def celcius(c):
  28.     print('In farenheit the temperature is',fahrenheit(c))
  29.     if c>30:
  30.         print('wow its hot! Find an AC!')
  31.     if c<-30:
  32.         print('omg its freezing! Find shelter!')
  33.     if -10<=c<=10:
  34.         print ('Are you back in dublin?')
  35.     if c>10:
  36.         print ('put on some shorts!')
  37.     if c<-10:
  38.         print ('put on a coat!')
  39.  
  40.        
  41. def main():
  42.     c=float(input('what is the temperature in celcius?'))
  43.     temperature=celcius(c)
  44.     print(temperature)
  45.     #print(temperatures())
  46.  
  47. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement