'TypeError: missing 2 required positional arguments
The code below runs like a breeze
from math import pow
def transformers(a, b, c, L):
hold = []
for x in L:
hold.append(int(a*pow(x,2) + b*x + c))
return sorted(hold)
print(transformers(-2, 7, 5, [-9,-1,2,4]))
However when I try to rewrite it using lambda i.e.
def lambdaIt(a, b, c, L):
return list(map(lambda a, b, c: a*pow(x,2) + b*x + c, L))
L = [-9, -1, 2, 4]
print(lambdaIt(-2, 7, 5, L))
the code is returning the following error:
TypeError: lambdaIt.<locals>.<lambda>() missing 2 required positional arguments: 'b' and 'c'
Please advice.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
