top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Convert temperature in Fahrenheit to Celsius

In this blog, we will talk about Converting Temperature from Fahrenheit to Celsius.

On the Fahrenheit scale, water freezes at 32 degrees and boils at 212 degrees.

On the Celsius scale, water freezes at zero degrees and boils at 100 degrees.

Now, we are going to write a python application that converts temperature in Fahrenheit to Celsius

First, we define a python function to convert from Fahrenheit to Celsius


def fahren_to_cels(input_temp):
    celsius = (input_temp - 32) * 5/9
    return celsius

As shown, the fahren_to_cels function takes the input_temp which is the temperature degree in Fahrenheit. Then, we use the following formula to convert the temperature from Fahrenheit to Celsius


After that, we return the celsius variable which is converted temperature in Celsius as we want.


So how does our program work?

We ask the user to enter the temperature in Fahrenheit as he wants by using the following line


temp = float(input("Enter a temperature in Fahrenheit: "))

Then, we got the input from the user like this


We pass the input value to the fahren_to_cels function as we have explained.

Finally, we got the output which is the temperature in Celsius


print("Temperature {} in Fahrenheit is equal to {} in Celsius".format(temp, fahren_to_cels(temp)))

you can refer to the complete code from here link













Comments


COURSES, PROGRAMS & CERTIFICATIONS

 

Advanced Business Analytics Specialization

Applied Data Science with Python (University of Michigan)

Data Analyst Professional Certificate (IBM)

Data Science Professional Certificate (IBM)

Data Science Specialization (John Hopkins University)

Data Science with Python Certification Training 

Data Scientist Career Path

Data Scientist Nano Degree Program

Data Scientist Program

Deep Learning Specialization

Machine Learning Course (Andrew Ng @ Stanford)

Machine Learning, Data Science and Deep Learning

Machine Learning Specialization (University of Washington)

Master Python for Data Science

Mathematics for Machine Learning (Imperial College London)

Programming with Python

Python for Everybody Specialization (University of Michigan)

Python Machine Learning Certification Training

Reinforcement Learning Specialization (University of Alberta)

Join our mailing list

Data Insight participates in affiliate programs and may sometimes get a commission through purchases made through our links without any additional cost to our visitors.

bottom of page