kelvin olarak verilen bir sıcaklık değerini santigrata dönüştürerek ekrana yazdıran programı Python dilinde yazınız

Cevap :

Cevap:

while True:

def celcius_to_fahrenheit():

sonuc1=((celcius*9) / 5) + 32

return sonuc1

def celcius_to_kelvin():

sonuc2=celcius+273

return sonuc2

def fahrenheit_to_celcius():

sonuc3=((fahrenheit-32)*5)/9

return sonuc3

def fahrenheit_to_kelvin():

sonuc4=(((fahrenheit-32)*5)/9)+273

return sonuc4

def kelvin_to_fahrenheit():

sonuc5=(((kelvin-273)*9)/5)+32

return sonuc5

def kelvin_to_celcius():

sonuc6=(kelvin-273)

return sonuc6

print "Celcius (1)"

print "Kelvin (2)"

print "Fahrenheit (3)"

print """

***************

"""

print "Programdan Çıkış (q) ya da (Q)"

print """

********************************************"""

print

soru=raw_input("Dönüştürmek istediğiniz birimin numarasını girin : ")

if soru=="1":

celcius=input("Celcius değerini girin : ")

print "%s Celcius, %s Kelvin'e eşittir." %(celcius, celcius_to_kelvin())

print "%s Celcius, %s Fahrenheit'a eşittir." %(celcius, celcius_to_fahrenheit())

print

elif soru=="2":

kelvin=input("Kelvin değerini girin : ")

print "%s Kelvin, %s Celcius'a eşittir." %(kelvin, kelvin_to_celcius())

print "%s Kelvin, %s Fahrenheit'a eşittir." %(kelvin, kelvin_to_fahrenheit())

print

elif soru=="3":

fahrenheit=input("Fahrenheit değerini girin : ")

print "%s Fahrenheit, %s Celcius'a eşittir." %(fahrenheit, fahrenheit_to_celcius())

print "%s Fahrenheit, %s Kelvin'e eşittir." %(fahrenheit, fahrenheit_to_kelvin())

print

elif soru=="q" or "Q":

print "Çıkış yaptınız.Güle Güle.."

break

else:

print ("İşlem numarası geçersiz. Programdan çıkılıyor.")

break

Açıklama:

tüm sıcaklık birimlerindeki değişim