#!/usr/bin/python
#
#by balloto
import os
def stampamenu():
print "********************************************"
print " BENVENUTO IN pythonTemperature 0.1 STABLE"
print "********************************************"
print ""
print "Modalita' del Programma:"
print ""
print "1) - Celsius => Kelvin"
print "2) - Kelvin => Celsius"
print "3) - Celsius => Fahrenheit"
print "4) - Fahrenheit => Celsius"
print "5) - Kelvin => Fahrenheit"
print "6) - Fahrenheit => Kelvin"
print "7) - Esci"
print ""
print "********************************************"
def continua():
enter = raw_input("Premi Invio per Continuare")
main()
def cel2kel():
cel = float(raw_input("Valore Celsius: "))
kel = float(cel+273)
print "Valore Kelvin: " + str(kel)
continua()
def kel2cel():
kel = float(raw_input("Valore Kelvin: "))
cel = float(kel-273)
print "Valore Celsius: " + str(cel)
continua()
def cel2far():
cel = float(raw_input("Valore Celsius: "))
far = float(((cel*9)/5)+32)
print "Valore Fahrenheit: " + str(far)
continua()
def far2cel():
far = float(raw_input("Valore Fahrenheit: "))
cel = float(((far-32)/9)*5)
print "Valore Celsius: " + str(cel)
continua()
def kel2far():
kel = float(raw_input("Valore Kelvin: "))
far = float((((kel-273)*9)/5)+32)
print "Valore Fahrenheit: " + str(far)
continua()
def far2kel():
far = float(raw_input("Valore Fahrenheit: "))
kel = float((((far-32)/9)*5)+273)
print "Valore Kelvin: " + str(kel)
continua()
def close():
print "Grazier per aver usato pT!"
os.system("sleep 2")
exit
def avvia(scelta):
if scelta == 1:
cel2kel()
elif scelta == 2:
kel2cel()
elif scelta == 3:
cel2far()
elif scelta == 4:
far2cel()
elif scelta == 5:
kel2far()
elif scelta == 6:
far2kel()
elif scelta == 7:
close()
else:
print "Opzione Inesistente!"
os.system("sleep 1.43")
main()
def main():
os.system("clear")
stampamenu()
print "\n"
scelta = int(raw_input("TUA SCELTA: "))
avvia(scelta)
main()