79680796

Date: 2025-06-26 15:46:47
Score: 1
Natty:
Report link

Create a composition (comp) function.

def increment(x):
    return x + 1

def double(x):
    return x * 2

def comp(f, g):
    return lambda x: g(f(x))

double_and_increment = comp(double, increment)

print(double_and_increment(5))
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Leonardo Lucena