Python Program to convert Celsius to Fahrenheit

Program

# Python Program to convert temperature in celsius to fahrenheit
celsiusVal = float(input('Enter a Celsius value you want to convert: '))
# calculate fahrenheit using the formula
# celsius * 1.8 = fahrenheit - 32
fahrenheit = (celsiusVal * 1.8) + 32
print('%0.1f degree Celsius = %0.1f degree Fahrenheit' %(celsiusVal,fahrenheit))

Output

$ python3 ConvertCelsiusToFahrenheit.py 
Enter a Celsius value you want to convert: 37.5
37.5 degree Celsius = 99.5 degree Fahrenheit

Tags: