Python Forum
TypeError: sum() missing 1 required positional argument: 'num2' - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: TypeError: sum() missing 1 required positional argument: 'num2' (/thread-31850.html)



TypeError: sum() missing 1 required positional argument: 'num2' - Insen - Jan-06-2021

def super_func(**kwargs):
    print(sum(kwargs))

super_func(num1 =1, num2=2)
Error:
TypeError Traceback (most recent call last) <ipython-input-195-6c0cf9eea71e> in <module> ----> 1 super_func(num1 =1, num2=2) <ipython-input-193-52558c3658cd> in super_func(**kwargs) 1 def super_func(**kwargs): ----> 2 print(sum(kwargs)) TypeError: sum() missing 1 required positional argument: 'num2'
Can you please help me with this error


RE: TypeError: sum() missing 1 required positional argument: 'num2' - Gribouillis - Jan-06-2021

You need to look where this 'sum' function is defined. Obviously it is not the standard 'sum' function from the Python library.

Or you can perhaps try sum(**kwargs)


RE: TypeError: sum() missing 1 required positional argument: 'num2' - Insen - Jan-06-2021

Thanks a lot it worked fine. I altered the sum function by mistake.


RE: TypeError: sum() missing 1 required positional argument: 'num2' - Insen - Jan-06-2021

Thank you got it.