a more pythonic way to count stuff in a for loop