Ask Your Question

Revision history [back]

You can try with global variables, something like:

Cell 1

a = 3

Cell 2

@interact(n=a)
def square(n):
    global a1
    print("{} squared is {}".format(n, n*n))
    a1 = n

Cell 3

a1