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):

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:
    w += 1

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