Loading ...
Sorry, an error occurred while loading the content.

6503User input in the Output Window

Expand Messages
  • pja
    Feb 18, 2010
      EditPlus is ALMOST a perfect IDE for Python (and I guess other
      programming languages). It seems to have a significant deficiency in
      that the Output Window cannot accept user input. The following Python
      program is an example (its Python 3 for those using older versions). The
      line "a, b, c - eval(input..." is looking for input from the user,

      Listed below the Python script are the outputs from EditPlus (which
      seems not to accept user input) and Sc1/Scite which does accept user input.

      Am I missing something with EditPlus or is this feature not supported.
      If it is not supported is it possible to ask for it to be considered for
      a future version (it really would be worthwhile).

      Regards,
      Peter


      # 7.2_quadratic3.py
      # A program that computes the real roots of a quadratic equation.

      import math

      def main():
      print("This program finds the real solutions to a quadratic\n")
      a, b, c = eval(input("Please enter the coefficients (a, b, c): "))

      discrim = b * b - 4 * a * c
      if discrim < 0:
      print("\nThe equation has no real roots!")
      else:
      discRoot = math.sqrt(b * b - 4 * a * c)
      root1 = (-b + discRoot) / (2 * a)
      root2 = (-b - discRoot) / (2 * a)
      print("\nThe solutions are:", root1, root2)

      main()


      EditPlus Output Window result:

      ---------- Python 3 ----------
      This program finds the real solutions to a quadratic

      Traceback (most recent call last):
      File "7.2_quadratic3.py", line 20, in <module>
      main()
      File "7.2_quadratic3.py", line 9, in main
      a, b, c = eval(input("Please enter the coefficients (a, b, c): "))
      RuntimeError: input(): lost sys.stdin

      Output completed (0 sec consumed) - Normal Termination

      Sc1 (Scite) Output window:

      >C:\Python31\pythonw -u "7.2_quadratic3.py"
      This program finds the real solutions to a quadratic

      Please enter the coefficients (a, b, c): 1,-4,-5

      The solutions are: 5.0 -1.0
      >Exit code: 0


      --
      *Peter Anderson*
      There is nothing more difficult to take in hand, more perilous to
      conduct, or more uncertain in its success, than to take the lead in the
      introduction of a new order of things—Niccolo Machiavelli, /The Prince/,
      ch. 6