
import sys

def     read_evaluate_print (prompt):
    """
    Read input, echo input
    """
    try:
        while True:
            print(end=prompt)
            line = input()
            print('⎕', line)
    except EOFError:
        apl_exit(None)

def     apl_quit ():
    """
    Quit without clean up
    """
    print ()
    sys.exit(0)

def     apl_exit (message):
    """
    Clean up and quit
    """
    if message is None:
        print ()
    else:
        print (message)
    sys.exit(0)

# EOF


import sys

def     read_evaluate_print (prompt):
    """
    Read input, echo input
    """
    try:
        while True:
            print(end=prompt)
            line = input().lstrip()
            if line:
                if line[0] == ')':
                    if line[0:4].upper() == ')OFF':
                        apl_exit("Bye bye")
            print('⎕', line)
    except EOFError:
        apl_exit(None)

def     apl_quit ():
    """
    Quit without clean up
    """
    print ()
    sys.exit(0)

def     apl_exit (message):
    """
    Clean up and quit
    """
    if message is None:
        print ()
    else:
        print (message)
    sys.exit(0)

# EOF

Add recognition of )OFF to mean exit gracefully
Add recognition of )OFF to mean exit gracefully

  
  import sys
  
  def     read_evaluate_print (prompt):
      """
      Read input, echo input
      """
      try:
          while True:
              print(end=prompt)
-             line = input()
+             line = input().lstrip()
+             if line:
+                 if line[0] == ')':
+                     if line[0:4].upper() == ')OFF':
+                         apl_exit("Bye bye")
              print('⎕', line)
      except EOFError:
          apl_exit(None)
  
  def     apl_quit ():
      """
      Quit without clean up
      """
      print ()
      sys.exit(0)
  
  def     apl_exit (message):
      """
      Clean up and quit
      """
      if message is None:
          print ()
      else:
          print (message)
      sys.exit(0)
  
  # EOF
  
Add recognition of )OFF to mean exit gracefully
## Code Before:

import sys

def     read_evaluate_print (prompt):
    """
    Read input, echo input
    """
    try:
        while True:
            print(end=prompt)
            line = input()
            print('⎕', line)
    except EOFError:
        apl_exit(None)

def     apl_quit ():
    """
    Quit without clean up
    """
    print ()
    sys.exit(0)

def     apl_exit (message):
    """
    Clean up and quit
    """
    if message is None:
        print ()
    else:
        print (message)
    sys.exit(0)

# EOF

## Instruction:
Add recognition of )OFF to mean exit gracefully
## Code After:

import sys

def     read_evaluate_print (prompt):
    """
    Read input, echo input
    """
    try:
        while True:
            print(end=prompt)
            line = input().lstrip()
            if line:
                if line[0] == ')':
                    if line[0:4].upper() == ')OFF':
                        apl_exit("Bye bye")
            print('⎕', line)
    except EOFError:
        apl_exit(None)

def     apl_quit ():
    """
    Quit without clean up
    """
    print ()
    sys.exit(0)

def     apl_exit (message):
    """
    Clean up and quit
    """
    if message is None:
        print ()
    else:
        print (message)
    sys.exit(0)

# EOF
