Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This is a Python newbie error, not really a Sage error. Here is some sample code, where I've inputted 5, 4, and 3 for your raw_input things.

sage: lista_xy
[(0.790543686599, 0.496880250983),
 (-0.00532463751733, -0.648275931599),
 (1.5688782027, 0.968919148436),
 (-1.65441823658, 0.556830151705),
 (-0.270724125206, 1.49786789808)]

Note that each j in this lista is a tuple of floating point numbers. So you can't take the [j] index. If you remove the [j] pieces and use j itself, your code works fine:

for j in lista_xy:
    x1 = j[0]
    y1 = j[1]
    while d2>1*1:
        x2 = uniforme_x.get_random_element()
        y2 = uniforme_x.get_random_element()

Good luck!