Sum function problem

sum which is imported from math module is not working in jupyter but it execute rightly in command prompt

Hello @Sanjeev-Kansal-227862581281703, kindly provide the code base or screenshot of the error you are facing. With these little information, it would be really tough for us to help you.

Hello Rahul,
‘sum()’ is a built in function in Python. You need not use the math module to do get the output.

Try it by using the following codes and you shall get the given outputs :
>>>

sum([1, 2, 3, 4, 5]) # sum values in a list
15

sum((1, 2, 3, 4, 5)) # sum values in a tuple
15

sum({1, 2, 3, 4, 5}) # sum values in a set
15

sum({1: “one”, 2: “two”, 3: “three”}) # sum values in a
6

If you still don’t get what you need then please refer to what @Manu-Pillai-1566551720093198 said.

I hope your doubt has been resolved @Sanjeev-Kansal-227862581281703?

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.