'Add number to a total in a for loop [closed]
I need to compute the mass of a series of objects in a list
for element in list:
weight = "a calculation here"
How do I save the weight calculation and add it up for each time it goes through the for loop?
Solution 1:[1]
for element in list:
weight += "a calculation here"
Does this work for you?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Teerapad Pipadboonyarat |
