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 int
s), 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.