Unlock the Power of Python: Temperature Conversion Made Easy
Converting Celsius to Fahrenheit: A Simple yet Effective Program
Imagine you need to convert a temperature from degree Celsius to degree Fahrenheit. The formula is straightforward: Fahrenheit = (Celsius * 9/5) + 32. Let’s put this formula into action with a Python program.
# Take temperature in Celsius as input
celsius = float(input("Enter temperature in Celsius: "))
# Convert Celsius to Fahrenheit
fahrenheit = (celsius * 9/5) + 32
# Print the result
print("Temperature in Fahrenheit:", fahrenheit)
Run the Program and See the Magic Happen
When you run this program, it will prompt you to enter a temperature in Celsius. Once you input the value, it will instantly convert it to Fahrenheit and display the result.
The Challenge: Convert Fahrenheit to Celsius
Now it’s your turn! Using the formula Celsius = (Fahrenheit – 32) * 5/9, create a Python program to convert Fahrenheit to Celsius. This exercise will help solidify your understanding of Python programming concepts.
# Your turn! Try writing a Python program to convert Fahrenheit to Celsius
More Python Programs to Explore
If you’re eager to practice more, why not try converting kilometers to miles? Here are some ideas:
Take your skills to the next level by exploring these programs and exercising your Python muscles!