Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #105540 > unrolled thread
| Started by | INADA Naoki <songofacandy@gmail.com> |
|---|---|
| First post | 2016-03-23 11:12 +0000 |
| Last post | 2016-03-23 11:12 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: 0 equals False, was Re: (unknown) INADA Naoki <songofacandy@gmail.com> - 2016-03-23 11:12 +0000
| From | INADA Naoki <songofacandy@gmail.com> |
|---|---|
| Date | 2016-03-23 11:12 +0000 |
| Subject | Re: 0 equals False, was Re: (unknown) |
| Message-ID | <mailman.48.1458731602.2244.python-list@python.org> |
Tips: Since True == 1, sum() can count Trues. >>> def count_even(seq): ... return sum(i%2 == 0 for i in seq) >>> count_even(range(100)) 50
Back to top | Article view | comp.lang.python
csiph-web