'I have two functions in Python: 1) converts Kelvin to celsius; 2) converts Celsius to Fahrenheit. Is there a way to combine the two functions into 1? [closed]

My first function is the following:

def converttemp_kelvin(k):
    c = k -273.1 
    return c
converttemp_kelvin(20)

My second function is the following:

def converttemp_fahrenheit(c):
    f = (c * (9/5) + 32)
    return f
converttemp_fahrenheit(-253.1)

I was reading about lambda, and got the following, but the ouput is definitely not right. Help pls!!

def composite_function(f, g):
    return lambda x : f(g(x))
 
def converttemp_kelvin(k):
    c = k -273.1 
    return c

def converttemp_fahrenheit(c):
    f = (c * 9/5) + 32
    return f

kelvin_fahrenheit = composite_function(converttemp_kelvin, converttemp_fahrenheit)

kelvin_fahrenheit(20)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source