|
|
От: |
13akaEagle
|
|
| Дата: | 29.08.11 07:06 | ||
| Оценка: | |||
K>sum(1 for item in container if item.type == 'first')
K>Sums start and the items of an iterable from left to right and returns the total. start defaults to 0. The iterable‘s items are normally numbers, and are not allowed to be strings. The fast, correct way to concatenate a sequence of strings is by calling ''.join(sequence). Note that sum(range(n), m) is equivalent to reduce(operator.add, range(n), m) To add floating point values with extended precision, see math.fsum().