Ask Your Question
0

How to take multiple outputs of a command and use them one by one later

asked 2014-10-17 00:09:55 -0500

algebraicallyclosed gravatar image

Hi,

This is what I am trying to achieve while using Sage worksheet interface.

Assume that I wrote a code and it gave, for example, for each i in a range of lists, list[0]. (First element of each list) So I have multiple outputs. Now I want to use these outputs, I want the system to consider them as a list, and take iterative combinations of elements of it. Can I do that, and how?

edit retag flag offensive close merge delete

Comments

2

hello, could you describe more precisely what you want to do? Or even better, put a simple version of your code of the first function...

vdelecroix gravatar imagevdelecroix ( 2014-10-17 09:44:23 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-10-18 05:49:06 -0500

calc314 gravatar image

I usually do this using a for loop. For example,

L=[[1,2],[3,4],[5,6]]
# overly simple example function
f(x)=x^2
for entry in L:
    #your code to run here
    f(entry[0])
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: 2014-10-17 00:09:55 -0500

Seen: 52 times

Last updated: Oct 18 '14