您好,登錄后才能下訂單哦!
def celsius_to_fahrenheit(celsius):
return celsius * 9 / 5 + 32
def fahrenheit_to_celsius(fahrenheit):
return (fahrenheit - 32) * 5 / 9
celsius = 25
fahrenheit = 77
print(f"{celsius} Celsius is equal to {celsius_to_fahrenheit(celsius)} Fahrenheit")
print(f"{fahrenheit} Fahrenheit is equal to {fahrenheit_to_celsius(fahrenheit)} Celsius")
def check_temperature(temp):
if temp < -273.15:
return "Temperature is below absolute zero"
elif temp > 100:
return "Temperature is too high"
else:
return "Temperature is within acceptable range"
temperature = 50
print(check_temperature(temperature))
def convert_temperature(temp, unit):
if unit.lower() == 'celsius':
return f"{temp} Celsius is equal to {celsius_to_fahrenheit(temp)} Fahrenheit"
elif unit.lower() == 'fahrenheit':
return f"{temp} Fahrenheit is equal to {fahrenheit_to_celsius(temp)} Celsius"
else:
return "Invalid unit specified"
temperature = 32
unit = 'fahrenheit'
print(convert_temperature(temperature, unit))
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。