you could use a list comprehension to do the same thing:
print sum([x for x in xrange(101)])
although the n(n+1)/2 is probably the best, I'd just like to point that out because I wish someone would have pointed out list comprehensions to me earlier :)
print sum([x for x in xrange(101)])
although the n(n+1)/2 is probably the best, I'd just like to point that out because I wish someone would have pointed out list comprehensions to me earlier :)