Error in lambda function..!

Shivlal Sharma sshivlal9601 at gmail.com
Sat Aug 29 03:58:32 EDT 2020


from functools import*
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
add = reduce(lambda a : a + 1, nums)
print(add)

error: -
TypeError                                 Traceback (most recent call last)
<ipython-input-15-684b5d4fac30> in <module>()
      1 from functools import*
      2 nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
----> 3 add = reduce(lambda a : a + 1, nums)
      4 print(add)

TypeError: <lambda>() takes 1 positional argument but 2 were given


More information about the Python-list mailing list