top of page
learn_data_science.jpg

Data Scientist Program

 

Free Online Data Science Training for Complete Beginners.
 


No prior coding knowledge required!

Fahrenheit to Celsius, a simple converter

Writer's picture: Sana OmarSana Omar

We start with writing the general theory - the rule of conversion:

Celsius = (Fahrenheit- 32) * 5/9

image recourse: https://vocal.media/lifehack/how-to-convert-celsius-to-fahrenheit-easy


First:

The program accepts the value of the Fahrenheit degree entered by the user and stores it in feh variable, as the following:


feh = float(input("Enter your temperature in Fehrenheit: "))

A prompt will appear for the user as:

Enter your temperature in Fehrenheit: 1000

Second, the conversion:

Then, the conversion is calculated using the previous mentioned rule and the result is stored in the variable celsius:


celsius = (feh - 32) * 5 / 9

Then the result is printed along with the converted Fahrenheit degree:


print("%0.2f degrees in Fehrenheit is %0.2f degrees in Celsius. " %(feh,celsius))

The result would be:

1000.00 degrees in Fehrenheit is 537.78 degrees in Celsius. 

Using the % symbol we linked the place of the variable in the sentence, f symbol is to determine that this value is float, 0.2 is the number of digits after the dot.


Also, we could just convert the celsius variable into String and printed:


print("The temperature in Celesius is :" + str(celsius))

It would result in the whole number:

The temperature in Celesius is :537.7777777777778

Thanks for reading.


0 comments

Recent Posts

See All

Comentarios


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