# Python Program to Convert Celsius to Kelvin

We will develop a Python program to convert Celsius to Kelvin. Celsius is currently a derived unit for temperature in the SI system, Kelvin being the base unit. The unit and the actual Celsius scale were first presented by a Swede Andreas Celsius in 1742. Celsius is also known as centigrade. It is an SI-derived unit used by most countries worldwide.

Kelvin is the base unit of temperature in the SI system (International System of Units). Kelvin unit’s abbreviation is K (no degree or degree sign).

Celsius to Kelvin Formula is given as,
K = ⁰C + 273.15

Mathematically,

Celsius = 10
Kelvin = 10 + 273.15 = 283.15
10 degrees Celsius is equivalent to 283.15 Kelvin

## Convert Celsius to Kelvin in Python

We will take a value of temperature in Celsius when declaring the variables. Then, find the value of temperature in Kelvin and store it in the variable. Finally, it will be displayed on the screen.

Program description:- Write a program that converts Celsius temperatures to Kelvin temperatures

``````# Python program to convert Celsius to Kelvin

# take inputs
cel = 10

# find temprature in Kelvin
kelvin = cel + 273.15

# print temperature in Kelvin
print('%0.1f degrees Celsius is equivalent to %0.1f Kelvin' %(cel, kelvin))
``````

Output:-

10.0 degrees Celsius is equivalent to 283.1 Kelvin

## Python Program to Convert Celsius to Kelvin

In the previous program, input is hardcoded in the program but in this program, input will be provided by the user.

``````# Python program to convert Celsius to Kelvin

# take inputs
cel = float(input('Enter temperature in Celsius: '))

# find temprature in Kelvin
kelvin = cel + 273.15

# print temperature in Kelvin
print('%0.1f degrees Celsius is equivalent to %0.1f Kelvin' %(cel, kelvin))
``````

Output for the input values test-case-1:-

Enter temperature in Celsius: 25
25.0 degrees Celsius is equivalent to 298.1 Kelvin

Output for the input values test-case-2:-

Enter temperature in Celsius: 51.03
51.0 degrees Celsius is equivalent to 324.2 Kelvin

## Celsius to Kelvin in Python using Function

We can also take the help of a function to convert temperature Celsius to Kelvin. A function is a block of code that performs a specific task.

Program description:- Write a Python program using the function to convert Celsius to Kelvin

``````# Python program to convert Celsius to Kelvin

def convertTemp(c):  #user-defined function
# find temperature in Kelvin
k = c + 273.15
return k

# take inputs
cel = float(input('Enter temperature in Celsius: '))

# calling function and display result
kelvin = convertTemp(cel)
print('%0.1f degrees Celsius is equivalent to %0.1f Kelvin' %(cel, kelvin))
``````

Output for the input values test-case-1:-

Enter temperature in Celsius: 0.95
0.9 degrees Celsius is equivalent to 274.1 Kelvin

Output for the input values test-case-2:-

Enter temperature in Celsius: -20
-20.0 degrees Celsius is equivalent to 253.1 Kelvin