Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Since you like R:

sage: L = r.rbinom(100,10,.5)
sage: L
  [1] 5 4 6 4 3 6 9 1 7 5 5 4 6 3 5 6 5 1 5 6 2 4 7 4 7 7 5 3 3 7 6 3 2 2 4 6 4 4 6 4 4 5 6 5 7 3 7
 [48] 7 3 5 4 7 7 6 4 3 2 4 5 5 7 2 5 2 3 2 3 4 6 7 8 6 6 3 4 2 6 3 5 3 8 6 8 5 5 2 5 5 5 2 5 7 5 5
 [95] 7 3 5 5 6 4
sage: M = L._sage_()
sage: type(M), len(M)
(<type 'list'>, 100)

Since you like R:

sage: L = r.rbinom(100,10,.5)
sage: L
  [1] 5 4 6 4 3 6 9 1 7 5 5 4 6 3 5 6 5 1 5 6 2 4 7 4 7 7 5 3 3 7 6 3 2 2 4 6 4 4 6 4 4 5 6 5 7 3 7
 [48] 7 3 5 4 7 7 6 4 3 2 4 5 5 7 2 5 2 3 2 3 4 6 7 8 6 6 3 4 2 6 3 5 3 8 6 8 5 5 2 5 5 5 2 5 7 5 5
 [95] 7 3 5 5 6 4
sage: M = L._sage_()
sage: type(M), len(M)
(<type 'list'>, 100)

You do get Python ints, not Sage Integers, though that wouldn't be hard to change with a list comprehension, presumably.