
Python은 섭씨 온도를 써서 화씨로 변환합니다:
1 2 3 4 5 | celsius = float(input('输入摄氏温度: '))
# 计算华氏温度
fahrenheit = (celsius * 1.8) + 32
print ('%0.1f 摄氏温度转为华氏温度为 %0.1f ' %(celsius,fahrenheit))
|
로그인 후 복사
공식 사용:
1 | fahrenheit = (celsius * 1.8) + 32
|
로그인 후 복사
Python은 화씨를 써서 섭씨로 변환합니다:
1 2 3 4 5 | fahrenheit = float(input('输入华氏温度: '))
# 计算摄氏温度
celsius = (fahrenheit - 32) / 1.8
print ('%0.1f 华氏温度转为摄氏温度为 %0.1f ' %(fahrenheit,celsius))
|
로그인 후 복사
공식:
1 | celsius = (fahrenheit - 32) / 1.8
|
로그인 후 복사
위 내용은 Python으로 온도 변환 쓰기의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!