Ask Your Question
1

Use the global variables assigned in an iterative expression

asked 2015-02-24 16:39:20 +0200

algebraicallyclosed gravatar image

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,

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-02-24 17:12:07 +0200

kcrisman gravatar image

Could you use prod() and a list?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-02-24 16:39:20 +0200

Seen: 169 times

Last updated: Feb 24 '15