Ora ho modificato così:
codice:
# PROGRAMMA DI CONVERSIONE GRADI CELSIUS-FAHRENHEIT E VICEVERSA
celsius = 0
cel = 0
ch = 0
ch2 = 0
fahr = 0
fa = 0
perpetuo = 10
def celtofa(celsius,cel):
print "Digita i gradi Celsius"
celsius = input("")
cel = celsius * 9
cel = cel / 5
cel = cel + 32
print celsius, " gradi celsius equivalgono a "
print cel, " gradi farhenheit"
repeatctf(choos, ch)
def fatocel(fahr, fa):
print "Digita i gradi Fahrenheit"
fahr = input("")
fa = fahr - 32
fa = fa / 9
fa = fa * 5
print fahr, " gradi fahrenheit corrispondono a "
print fa, " gradi celsius"
repeatftc(choos, ch2)
choos = 0
def repeatctf(choos, ch):
if choos == 1:
celtofa(celsius,cel)
print "1] Ripeti"
print "2] Termina"
ch = input()
if ch == 1:
celtofa(celsius,cel)
if ch == 2:
print "Esci"
def repeatftc(choos, ch2):
if choos == 2:
fatocel(fahr,fa)
print ""
print "1] Ripeti"
print "2] Termina"
ch2 = input()
if ch2 == 1:
fatocel(fahr,fa)
if ch2 == 2:
print "Esci"
def scelta(choos):
print "1] Conversione Celsius in Fahrenheit"
print "2] Conversione Fahrenheit in Celsius"
choos = input("Scegli la tua opzione: ")
if choos == 1:
while perpetuo == 10:
repeatctf(choos,ch)
if choos == 2:
while perpetuo == 10:
repeatftc(choos,ch2)
scelta(choos)
raw_input("Premi per uscire")
ho solo bisogno di sapere come far terminare il programma cliccando su "2"