Python - Convert temperature from Celsius to Fahrenheit using Lambda Function

Here, we are going to learn how to convert temperature from Celsius to Fahrenheit using lambda function? By Pankaj Singh Last updated : December 27, 2023

Problem statement

Write a Python program to convert temperature from Celsius to Fahrenheit using lambda function.

Python program to convert temperature from Celsius to Fahrenheit using lambda function

# lambda function
ctof = lambda c: 9 / 5 * c + 32

# input
c = int(input("Enter Temp(C) : "))

# function call
f = ctof(c)

# print
print("Temp(F) :", f)

Output

Enter Temp(C) : 10
Temp(F) : 50.0

In this example, we have used the following Python basic topics that you should learn:

Python Lambda Function Programs »

Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.