Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
a = [2,98,58,45]
b = sum(a)


print(b)
#after printing b i am getting sum of above
#I assume that python itself identifies sum as a function to add 
#please be simple in your answer if my assumption is right logically


What I have tried:

I have tried to add variables in a list without creating a addition function .
Let me know if it works
Posted
Updated 3-Jan-23 0:09am

1 solution

A quick Google would have found you Built-in Functions sum() — Python 3.11.1 documentation[^]
 
Share this answer
 
Comments
CPallini 3-Jan-23 8:00am    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900