Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Try

for k in srange(3):
    for j in srange(3):
        print (j,k),f(j,k)

instead. Standard pitfall unfortunately: in python 2, "integer" division is truncating. Normally sage will provide you with "sage" integers for which division produces rational numbers, but if you use "range" then sage doesn't get the chance.