Python:Sum an Array

From Progzoo
Jump to: navigation, search

You can add the numbers in the array [6,7,29] using a loop or using built-in method.

An alternative (and better) method:

a = [6,7,29]
print sum(a)
[Font] [Default] [Show] [Resize] [History] [Profile]