code: def getch():
      
  
      if sys.platform in ['darwin', 'linux']:
          import termios
          import tty
          file_descriptor = sys.stdin.fileno()
          settings = termios.tcgetattr(file_descriptor)
          try:
              tty.setraw(file_descriptor)
              return sys.stdin.read(1)
          finally:
              termios.tcsetattr(file_descriptor, termios.TCSADRAIN, settings)
      elif sys.platform in ['cygwin', 'win32']:
          import msvcrt
          return msvcrt.getwch()
docs: Request a single character input from the user.