>>> count = 0
>>> for c in "##.#.":
... count = count + 1 if c == '.' else 0
...
>>> print(count)
1
>>> count = 0
>>> for c in "##.#.":
... count = count + (1 if c == '.' else 0)
...
>>> print(count)
2
Why doesn't the first example print out a counter of 2?