×

Python program to convert Celsius into Fahrenheit

Python program to convert Celsius into Fahrenheit

This program explains how we can take the temperature in Celsius and convert them into Fahrenheit.

Celsius

Celsius, also known as centigrade, is a measurement unit representing temperature. It is named after the Swedish astronomer Anders Celsius. It is an SI derived unit used by most countries worldwide.

Fahrenheit

It is also used for the measurement of the temperature scale. It is named after Polish-born German physicist Daniel Gabriel Fahrenheit. It uses degrees Fahrenheit as a unit for temperature.

The mathematical formula to convert degree Celsius into degree Fahrenheit is given below:

celsius * 1.8 = Fahrenheit – 32

Example

Input:  Temp = 40 degree Celsius  
Output:  Temp = 104 degree Fahrenheit 40 * 1.8 = Fahrenheit – 32 72 + 32 = Fahrenheit Fahrenheit = 104 degree

Source Code:

The following source code converts the Celsius into Fahrenheit:

#Program to convert degree Celsius into degree Fahrenheit      
#Take the temperature in degree Celsius   
Temp_celc = float(input("Enter temperature in degree Celsius:")) 
 #Convert into Fahrenheit  
Fahrenheit = (Temp_celc * 1.8) + 32  
#Print result  
print('%0.1f degree Celsius is equal to %0.1f degrees Fahrenheit' %(Temp_celc, Fahrenheit))

Output

Here is the output:

Python program to convert Celsius into Fahrenheit

Explanation: In this program, we will input from the user and store it in a variable. Next, we have applied the conversion formula that converts the temperature in degree Celsius into degree Fahrenheit and stores it in a variable. Finally, it will print the result on the screen.


Related Topics

Subprocess in Python

In this tutorial, we will understand what is a subprocess in python and will understand how to use it. Subprocess A subprocess is a very prevailing portion of the python library. It...

3 minutes read.

Python Dictionary items() method

Python Dictionary items() method The dictionary.items() method in Python returns a view object that displays a list of dictionary's (key, value) tuple pairs. Syntax dictionary.items() Parameter NA Return This method returns a view object, displaying the list...

1 minute read.

Python String count() method

Python String count() method The string.count() method returns the number of times a specified value appears in the string. Syntax string.count(sub[, start[, end]]) Parameter sub: This parameter represents a substring to be searched. start: This parameter...

1 minute read.

tell() function in Python

Introduction The tell() function in Python is used to return the current position of the file read/write pointer within the file. An integer value is returned by this method, and it...

2 minutes read.

Python BS4 Code

Python BS4 Code The BS4 stands for BeautifulSoup version 4.x. The BeautifulSoup is a Python library which is used for pulling out data of the HTML & XML files using the...

14 minutes read.

Python str() function

Python str() function The str() function in Python converts the specified value into a string. Syntax class str(object='')           or class str(object=b'', encoding='utf-8', errors='strict') Parameter object:  This parameter represents any object to convert the given...

1 minute read.

List Comprehension in Python

Sometimes we need new lists that are completely based on previously existing lists, so to perform this operation successfully, some of the programming languages come with a syntactic construct known...

5 minutes read.

Creating new Database using Python MySQL

In this article, we are going to discuss how to create a new database by connecting Python and MySQL. What is a Database? The places or memory used to secure highly and...

6 minutes read.

Python String center() method

Python String center() method The center() method will center align the string, using a specified character (space is default) as the fill character. Syntax string.center(width[, fillchar]) Parameter width This parameter represents the length of the returned string. fillchar...

1 minute read.

Python try catch exception

The try-except proclamation can deal with exceptions. Exceptions might happen when you run a program. Exceptions are blunders that occur during the execution of the program. Python won't educate you regarding...

3 minutes read.

Accuracy_score Function in Sklearn

A crucial stage in data science is measuring our model's performance using the appropriate metric. In this article, we will examine two methods for calculating the accuracy of your predictions:...

13 minutes read.

Python Assert

Python Assert Python provides an assert statement which is used to check the logical expression. If the given logical expression is true, then it precedes for the next line; otherwise, it raises an...

2 minutes read.

How to convert Float to Int in Python?

A float value can be converted to an int via type conversion, an explicit method of transforming an operand to a certain type. But it must be noted that such...

3 minutes read.

Python String capitalize() method

Python String capitalize() method The string.capitalize() method in Python returns a copy of the string with only its first character capitalized. Syntax string.capitalize() Parameter NA Return This function returns a string where the first character is upper...

1 minute read.

Python String istittle() method

Python String istittle() method The string.istittle() method returns a boolean value true if the string is a titlecased string and there is at least one character, for example uppercase characters may...

2 minutes read.

Django vs NodeJS

Django and NodeJS are open-source frameworks used to develop web applications. Both Django and NodeJS are cross-platform and robust technology used for developing versatile web applications and mobile applications. Django Django is...

2 minutes read.

Keyboard Jump Game in Python

Keyword hop (jump) game is a speed composing game that aides in further developing the composing velocity of players The object of Keyboard Jump (hop) Game Python Project is to fabricate...

7 minutes read.

Drop() Function in Python

Drop() Function: The python programming language consists of various libraries; some of them are pandas and matplotlib. Data scientists mainly use the pandas library to analyze the data more easily and...

3 minutes read.

Python Num2words

Python: Python programming language is one of the most used programming languages, as it is used widely in the field of software and data analysis, web development, etc. It is said...

3 minutes read.

Cross Validation in Sklearn

Data scientists can benefit from cross-validation in machine learning in two key ways: it can assist in minimising the amount of data needed and ensure the artificial intelligence model is...

14 minutes read.