top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Writer's pictureArpan Sapkota

Fahrenheit to Celsius Conversion



For the conversion of temperature from Fahrenheit to Celsius first thing we are going to do is to ask the user for the temperature in Fahrenheit.


We will convert the temperature into float using float() so that we can perform calculations on it.

temp = float(input("Enter Temperature in Fahrenheit:"))

Now finally let's perform calculation and convert the temperature into Celsius.

celsius = (temp - 32) * 5/9

This expression you see above is the general formula to convert Fahrenheit into Celsius.

Now finally let's print our temperature in Celsius:

print(f"{temp} in Fahrenheit is equal to {celsius} in Celsius")

Here we go we are done! Here we have used f-strings to directly place the variable within the print statement.


0 comments

Recent Posts

See All

Comments


bottom of page