# Revision history [back]

Probably. Have you tried looking at

sage: animate?


and

sage: interact?


(the latter only works in the notebook). I would think one or both of these should work just fine.

Probably. Have you tried looking at

sage: animate?


and

sage: interact?


(the latter only works in the notebook). I would think one or both of these should work just fine.

Edit after update of question:

The first example will never work because of how Python handles variables.

sage: k = 5
sage: f = Piecewise([[(-2,1),k],[(1,4),x]])
sage: f
Piecewise defined function with 2 parts, [[(-2, 1), 5], [(1, 4), x]]


So k just slapped a 5 in there.

Let me try to see if I can come up with a workaround...