Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Figured out the the reason as well: with

for w in range(1, N):
    fill(w)

the type of w is int, and so is the type of h inside the inner loop in fill. So something like w/(w+h) uses integer division (on ints), giving 0.

On the other hand, with

w = 1
while w < N:
    fill(w)
    w += 1

the type of w is Integer, so w/(w+h) results in a proper fraction and not 0.