Ask Your Question

Revision history [back]

Instead of:

sage: for a in [0,1,2]:
....:     print(a**2)
....:         
0
1
4

do

sage: L = []
sage: for a in [0,1,2]:
....:     L.append(a**2)
....:     
sage: L
[0, 1, 4]

Then you have access to the list L, you can pick and choose elements from it, etc. For example:

sage: L[2]
4