Python Temperature Conversion
Temperature can be converted between Celsius, Fahrenheit, and Kelvin using simple formulas. Python lets you implement these conversions easily.
तापमान को Celsius, Fahrenheit और Kelvin के बीच सरल फार्मूलों से बदला जा सकता है। Python में इन कन्वर्ज़न को आसानी से किया जा सकता है।
Conversion Formulas:
- Celsius to Fahrenheit:
F = (C × 9/5) + 32 - Fahrenheit to Celsius:
C = (F - 32) × 5/9 - Celsius to Kelvin:
K = C + 273.15 - Kelvin to Celsius:
C = K - 273.15 - Fahrenheit to Kelvin:
K = (F - 32) × 5/9 + 273.15 - Kelvin to Fahrenheit:
F = (K - 273.15) × 9/5 + 32
- Celsius से Fahrenheit:
F = (C × 9/5) + 32 - Fahrenheit से Celsius:
C = (F - 32) × 5/9 - Celsius से Kelvin:
K = C + 273.15 - Kelvin से Celsius:
C = K - 273.15 - Fahrenheit से Kelvin:
K = (F - 32) × 5/9 + 273.15 - Kelvin से Fahrenheit:
F = (K - 273.15) × 9/5 + 32
Example 1: Celsius to Fahrenheit
celsius = 25
fahrenheit = (celsius * 9/5) + 32
print(f"{celsius}°C = {fahrenheit}°F")
Converts 25 Celsius to Fahrenheit.
25 Celsius को Fahrenheit में बदला गया।
Output:
Example 2: Fahrenheit to Celsius
fahrenheit = 77
celsius = (fahrenheit - 32) * 5/9
print(f"{fahrenheit}°F = {celsius}°C")
Converts 77 Fahrenheit to Celsius.
77 Fahrenheit को Celsius में बदला गया।
Output:
Example 3: Celsius to Kelvin
celsius = 25
kelvin = celsius + 273.15
print(f"{celsius}°C = {kelvin} K")
Converts 25 Celsius to Kelvin.
25 Celsius को Kelvin में बदला गया।
Output:
Example 4: Kelvin to Celsius
kelvin = 298.15
celsius = kelvin - 273.15
print(f"{kelvin} K = {celsius}°C")
Converts 298.15 Kelvin to Celsius.
298.15 Kelvin को Celsius में बदला गया।
Output:
Example 5: Fahrenheit to Kelvin
fahrenheit = 77
kelvin = (fahrenheit - 32) * 5/9 + 273.15
print(f"{fahrenheit}°F = {kelvin} K")
Converts 77 Fahrenheit to Kelvin.
77 Fahrenheit को Kelvin में बदला गया।
Output:
Example 6: Kelvin to Fahrenheit
kelvin = 298.15
fahrenheit = (kelvin - 273.15) * 9/5 + 32
print(f"{kelvin} K = {fahrenheit}°F")
Converts 298.15 Kelvin to Fahrenheit.
298.15 Kelvin को Fahrenheit में बदला गया।
Output: