First time here? Check out the FAQ!

Ask Your Question
1

Use the global variables assigned in an iterative expression

asked 10 years ago

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,

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 10 years ago

kcrisman gravatar image

Could you use prod() and a list?

Preview: (hide)
link

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: 10 years ago

Seen: 255 times

Last updated: Feb 24 '15