CoCalc Public Filessupport / 2015-03-23-194232-raw_input.sagewsOpen in with one click!
Author: William A. Stein
Description: Jupyter notebook support/2015-06-04-141749-bokeh.ipynb
name = raw_input('What is your name? ') print "Hello", name
What is your name?
Hello william
print "hi" 2 + 3 clear() print "after clear"
after clear
print "hello" print "some stuff" sys.stdout.flush() sleep(1) delete_last_output() print "this"
hello this
r = raw_input('radius = ', default='1', label_width='10ex', type='sage') c = raw_input('color = ', default='red', label_width='10ex', type=Color) n = raw_input('number of sphere = ', default=1, label_width='10ex', type=Integer) sum(sphere((10*random(), 10*random(), 10*random()), size=r, color=c) for i in range(n))
radius =
color =
number of sphere =
3D rendering not yet implemented
File: /projects/4a5f0542-5873-4eed-a85c-a18c706e8bcd/.sagemathcloud/ Signature : raw_input(prompt='', default='', placeholder='', input_width=None, label_width=None, type=None) Docstring : Read a string from the user in the worksheet interface to Sage. INPUTS: * prompt -- (default: '') a label to the left of the input * default -- (default: '') default value to put in input box * placeholder -- (default: '') default placeholder to put in grey when input box empty * input_width -- (default: None) css that gives the width of the input box * label_width -- (default: None) css that gives the width of the label * type -- (default: None) if not given, returns a unicode string representing the exact user input. Other options include: * type='sage' -- will evaluate it to a sage expression in the global scope. * type=anything that can be called, e.g., type=int, type=float. OUTPUT: * By default, returns a **unicode** string (not a normal Python str). However, can be customized by changing the type. EXAMPLE: print salvus.raw_input("What is your full name?", default="Sage Math", input_width="20ex", label_width="15ex")
raw_input("What's up?")
What's up?
u'up there'
# inside an interact? It works, but evidently "delete_last_cell" isn't implemented inside interacts yet, so # you'll see the raw_input form twice. @interact def _(n=5): m = raw_input("n=%s, and m=?"%n, type='sage') print n+m
Interact: please open in CoCalc