Ask Your Question

Use the global variables assigned in an iterative expression

asked 2015-02-24 09:39:20 -0500

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


and so on. But I can not do


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

answered 2015-02-24 10:12:07 -0500

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


Asked: 2015-02-24 09:39:20 -0500

Seen: 33 times

Last updated: Feb 24 '15