Skip to main content
1 of 4
jazzpi
  • 886
  • 5
  • 9

Python 3, 181

a=0
def s(x):return["a="+str(x),"a=0"][x==-1or x==256]
while 1:
 print(">>")
 for i in input():u,b,o=s(a+1),s(a*a),"print(a)";exec(dict(i=u,x=u,d=s(a-1),s=b,k=b,o=o,c=o).get(i,""))

This outputs a newline after the >>, but the OP didn't say that wasn't allowed.

jazzpi
  • 886
  • 5
  • 9