Python program to convert the temperature in degree centigrade to Fahrenheit
#Python #program to convert the temperature in degree centigrade to Fahrenheit #question #celsius to fahrenheit python program
Temperature conversion is a common mathematical calculation in various applications. In this article, we will learn how to convert a temperature from degrees Celsius to Fahrenheit using Python. This is a simple yet important program often asked in coding interviews and beginner-level programming exercises.
To convert temperature from Celsius to Fahrenheit, we use the following formula:
Fahrenheit = (1.8 * Celsius) + 32
Where:
Below is a Python program that takes user input for temperature in Celsius and converts it to Fahrenheit:
# Python program to convert Celsius to Fahrenheit
c = input("Enter temperature in Celsius: ")
# Convert the input to float and apply the formula
f = (9 * float(c) / 5) + 32
# Display the result
print(f"Temperature in Fahrenheit is: {f:.2f} ")
37
37.00 Celsius is: 98.60 Fahrenheit
This Python program allows users to easily convert temperature from Celsius to Fahrenheit. By understanding and implementing this simple logic, you can expand the program to perform more complex temperature conversions, such as Fahrenheit to Celsius or Kelvin conversions. Try modifying the code to include other temperature scales and enhance your Python skills!