def calculator_prompt():
 print 'Welcome to the calculator. Press Ctrl+C to exit.'
 cp = CalcParser()
 try:
  while True:
   try:
    line = raw_input('--> ')
    print cp.calc(line)
   except ParseError as err:
    print 'Error:', err
 except KeyboardInterrupt:
  print '... Thanks for using the calculator.'

def calculator_prompt ( ) : print 'Welcome to the calculator. Press Ctrl+C to exit.' cp = CalcParser ( ) try : while True : try : line = raw_input ( '--> ' ) print cp . calc ( line ) except ParseError as err : print 'Error:' , err except KeyboardInterrupt : print '... Thanks for using the calculator.'
a toy calculator prompt for interactive computations .