Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Use the global variables assigned in an iterative expression

Hi everyone. Assume that I have assigned some global variables to items of a list L (L is a list of polynomials guess) such as

for i, item in enumerate(L):
      globals()['g%s'%i] = item

Now I want to get the multiplication of

g0*g1*g2*...

and so on. But I can not do

mul('g%s'%i..)

or something. How can I get this multiplication (as an example of the concept) without writing all the assigned g0, g1, etc.? Thanks for help,