def _has_constant_term(p, x):
 R = p.ring
 iv = R.gens.index(x)
 zm = R.zero_monom
 a = ([0] * R.ngens)
 a[iv] = 1
 miv = tuple(a)
 for expv in p:
  if (monomial_min(expv, miv) == zm):
   return True
 return False

def _has_constant_term ( p , x ) : R = p . ring iv = R . gens . index ( x ) zm = R . zero_monom a = ( [ 0 ] * R . ngens ) a [ iv ] = 1 miv = tuple ( a ) for expv in p : if ( monomial_min ( expv , miv ) == zm ) : return True return False
check if p has a constant term in x examples .