Write a Python program to convert temperature in degree Celsius to degree Fahrenheit. If water boils at 100 degree C and freezes as 0 degree C, use the program to find out what is the boiling point and freezing point of water on the Fahrenheit scale. (Hint: T(deg F) = T(deg C) * 9 / 5 + 32 )
Question
Write a Python program to convert temperature in degree Celsius to degree Fahrenheit. If water boils at 100 degree $\mathrm{C}$ and freezes as 0 degree $\mathrm{C}$, use the program to find out what is the boiling point and freezing point of water on the Fahrenheit scale.
(Hint: $\mathrm{T}\left({ }^{\circ} \mathrm{F}\right)=\mathrm{T}\left({ }^{\circ} \mathrm{C}\right) \times 9 / 5+32$ )
✨ Free AI Tools for You
Powered by Chatterbot AI
Answer
To convert temperature from degrees Celsius to degrees Fahrenheit, you can use the formula provided:
$$ T(°F) = T(°C) \times \frac{9}{5} + 32 $$
Here's a Python program to perform the conversion and find out the boiling and freezing points of water in the Fahrenheit scale:
# Function to convert Celsius to Fahrenheit
def celsius_to_fahrenheit(celsius):
return (celsius * 9/5) + 32
# Boiling and Freezing points of water in Celsius
boiling_point_celsius = 100
freezing_point_celsius = 0
# Convert to Fahrenheit
boiling_point_fahrenheit = celsius_to_fahrenheit(boiling_point_celsius)
freezing_point_fahrenheit = celsius_to_fahrenheit(freezing_point_celsius)
# Output the results
print("Boiling point of water in Fahrenheit:", boiling_point_fahrenheit)
print("Freezing point of water in Fahrenheit:", freezing_point_fahrenheit)
Output:
Boiling point of water in Fahrenheit: 212.0
Freezing point of water in Fahrenheit: 32.0
Explanation:
Function Definition: The
celsius_to_fahrenheit
function takes a temperature in degrees Celsius and converts it to degrees Fahrenheit using the formula.Conversion: The program calculates the boiling and freezing points of water in Fahrenheit by passing 100°C and 0°C to the conversion function.
Output: Displays the boiling point (212°F) and freezing point (32°F) on the Fahrenheit scale.
India's 1st AI Doubt Solver for CBSE, JEE, and NEET
Ask a Question for Freeand then it's just ₹212 a month