[Tutor] style question

Christopher Smith csmith@blakeschool.org
Wed, 20 Feb 2002 14:38:44 -0600

I have a question of style and am wondering if you would consider giving
some feedbakc.  Let's say you have a task of finding out how many of 5
positive integer numbers (a-e) are even.  Which (if either) of the two
codes would be preferred:

# {option A}

# {option B}
if a%2==0:	
	even = even + 1
if b%2==0:	
	even = even + 1
if c%2==0:	
	even = even + 1
if d%2==0:	
	even = even + 1
if e%2==0:	
	even = even + 1
odd = 5 - even

Is option A guilty of relying on the "side effect" of mod 2 being a 1 or
zero or is this a desireable/understandable use of this function's return