Ask Your Question

Revision history [back]

You need a colon:

if (v==0): f.factor()

I would actually write this as:

if f.is_irreducible():
    f.factor()

Your assignment of v=f.is_irreducible() doesn't seem to be necessary unless you want to use v several times later. If so, you could do

v = f.is_irreducible()
if not v:  # better than checking v == 0
    f.factor()

You need a colon:

if (v==0): f.factor()

I would actually write this as:

if not f.is_irreducible():
    f.factor()

Your assignment of v=f.is_irreducible() doesn't seem to be necessary unless you want to use v several times later. If so, you could do

v = f.is_irreducible()
if not v:  # better than checking v == 0
    f.factor()