On 02/27/2013 10:32 PM, eli m wrote:
How would you find the slope, y intercept, and slope-intercept form equation 
for a line in python?


First, I'd form a more complete description of the problem. Specify what the overall constraints are (eg. Python version, OS portability, where input is to be gotten, and what the input values are to mean, how results are to be represented)

Then, I'd write a series of tests, especially showing both parameters that will work, and parameters that should give exceptions.

Then, I'd break the problem description into steps in a pseudo code form. For example, maybe get the input parameters (which are they, and in what order) from the command line. Validate the inputs, and make sure an answer is possible. Then apply this formula, and print the result. Apply that formula and print the result. Apply the third formula and print the result. Exit the program.

Next, I'd translate that pseudo code into actual Python statements, and type it into a text editor.

Then run those tests, and for each that fails, either revise the test or the code, depending on which is wrong.

If you run into trouble on one of these steps, show us your work, and somebody will undoubtedly be able to help there.

--
DaveA
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to