equivalent of NULL or OM in Python
Harry George
hgg9140 at seanet.com
Fri Feb 16 08:53:19 EST 2001
I think you are talking about "None".
For iterating over polynomials, I could put "m3na" (numerical
analysis, in Modula-3) on a web site for you. It does polynomial
math. For iterating over tuples in general, they are sequences so you
can do
for term in poly:
do_something_to_term
"cyberian bear" <cyberian_bear at hotmail.com> writes:
> 1.I'm doing a program in Python which perform +, -, *, / on two polynomials.
> Their coefficient and exponentials are stored in tuples. So for example
> 3X^2+4X+4 would be stored like [(2,3),(1,4),(0,4)] but what if the term is
> absent completely from one of the polynomials then i would have to check if
> one of the tuuples is not present at all and not just zero. For example
> [(2,3),(0,4)]. In Pascal there is NULL in SETL there is OM but is there a
> corresponding statement in Python. I've checked through several sources
> including my textbook but didn't find the satisfactory answer. Maybe I
> should just check if the second term of every tuple(i.e the coefficient) is
> zero which means that the term is not present.
> 2. Also can anyone give me a clue how to iterate over all the coefficient
> terms in the tuples in the first polynomials' tuples.
> My guess is should be something like
> for coefficient in polynomial1:
> where polynomial is a list of tuples
> but how do i tell it to iterate specifically over the second term in every
> tuple and not over the whole tuples
> cb
>
>
--
Harry George
hgg9140 at seanet.com
More information about the Python-list
mailing list