# Revision history [back]

Actually, I think you do want the Sage Cell Server. For example, copy this simple example into a Sage Cell Server:

@interact
def Midpoint(ShowSolution=checkbox(default=True, label='Check to show solution')):
x1=Integer(randint(-5,10))
x2=Integer(randint(-5,10))
y1=Integer(randint(-5,10))
y2=Integer(randint(-5,10))
html('Find the midpoint of $(%s,%s)$ and $(%s,%s)$.'% (x1,y1,x2,y2))
if ShowSolution==True:
html('$M=\\left(\\frac{(%s)+(%s)}{2},\\frac{(%s)+(%s)}{2}\\right)$'%(x1,x2,y1,y2))
html('$M=\\left(\\frac{%s}{2},\\frac{%s}{2}\\right)$'%(x1+x2,y1+y2))
if (x1+x2)/2 in ZZ or(x1+x2)/2 in ZZ:
html('$M=\\left(%s,%s\\right)$'%(latex((x1+x2)/2),latex((y1+y2)/2)))


You can probably see the LaTeX portion is done through html. Notice also that backslashes are now double backslashes.

Actually, I think you do want the Sage Cell Server. For example, copy this simple example into a Sage Cell Server:

@interact
def Midpoint(ShowSolution=checkbox(default=True, label='Check to show solution')):
x1=Integer(randint(-5,10))
x2=Integer(randint(-5,10))
y1=Integer(randint(-5,10))
y2=Integer(randint(-5,10))
html('Find the midpoint of $(%s,%s)$ and $(%s,%s)$.'% (x1,y1,x2,y2))
if ShowSolution==True:
html('$M=\\left(\\frac{(%s)+(%s)}{2},\\frac{(%s)+(%s)}{2}\\right)$'%(x1,x2,y1,y2))
html('$M=\\left(\\frac{%s}{2},\\frac{%s}{2}\\right)$'%(x1+x2,y1+y2))
if (x1+x2)/2 in ZZ or(x1+x2)/2 in ZZ:
html('$M=\\left(%s,%s\\right)$'%(latex((x1+x2)/2),latex((y1+y2)/2)))


You can probably see the LaTeX portion is done through html. Notice also that backslashes are now double backslashes. You can press "Evaluate" for more problems or redesign the code to allow student select the number of problems.