Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168703
Image: ubuntu2004
# --- global --- display_points = Graphics() n_points_global = 5 for i in range(n_points_global): display_points += point((round(10 * random(), 0), round(10 * random(), 0))) @interact def point_setting( point_operation = ['Reset', 'Add a point'], n_points_local = input_box(default = n_points_global, label = 'number of points:', width = 5) ): global display_points, n_points_global if point_operation == 'Add a point': display_points += point((round(10 * random(), 0), round(10 * random(), 0))) n_points_global += 1 n_points_local = n_points_global point_operation = 'Reset' print "number of points = ", len(display_points) show(display_points, xmin = 0, xmax = 10, ymin = 0, ymax = 10)