Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40112

Re: How would you do this?

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'exit': 0.07; 'next,': 0.07; 'tests,': 0.07; 'subject:How': 0.09; 'python': 0.09; 'editor.': 0.09; 'subject:would': 0.09; 'result.': 0.15; '(eg.': 0.16; 'exceptions.': 0.16; 'formula': 0.16; 'mean,': 0.16; 'order)': 0.16; 'statements,': 0.16; 'wrote:': 0.17; 'specify': 0.17; 'code,': 0.18; 'input': 0.18; 'translate': 0.20; 'parameters': 0.20; 'python?': 0.20; 'work,': 0.22; "i'd": 0.22; 'somebody': 0.23; 'command': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(which': 0.26; 'values': 0.26; 'first,': 0.27; 'there.': 0.28; 'actual': 0.28; 'trouble': 0.28; 'run': 0.28; 'maybe': 0.29; 'version,': 0.30; 'code': 0.31; 'problem.': 0.32; 'print': 0.32; 'problem': 0.33; 'to:addr:python- list': 0.33; 'form.': 0.33; 'text': 0.34; 'third': 0.34; 'especially': 0.35; 'pm,': 0.35; 'subject:?': 0.35; 'test': 0.36; 'should': 0.36; 'subject:: ': 0.38; 'possible.': 0.38; 'sure': 0.38; 'description': 0.39; 'to:addr:python.org': 0.39; 'apply': 0.39; 'received:192': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'help': 0.40; 'your': 0.60; 'series': 0.63; 'more': 0.63; 'show': 0.63; 'results': 0.65; 'validate': 0.65; 'overall': 0.66; 'received:74.208': 0.71; 'subject:this': 0.84; '10:32': 0.84; 'received:74.208.4.194': 0.84; 'subject:you': 0.88; 'eli': 0.93
Date Thu, 28 Feb 2013 01:29:03 -0500
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
MIME-Version 1.0
To python-list@python.org
Subject Re: How would you do this?
References <0318f314-91e5-472a-a664-054ca7ea5097@googlegroups.com>
In-Reply-To <0318f314-91e5-472a-a664-054ca7ea5097@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:c0OOXSmGjVteOepB795QmBXTITJVqa/JPeA2vM8gEgV w0uh0hKQoQBsRe1uK/9lLQDAvUP8R+341k8JsqPb8fFvD2/Mk+ NC4btqO0T0Yv6D2ZIQIgRh/g3eWtu0uRGiLYPiTMsXYLbsGnoQ MJEi4k97g0lW6gz890nXSgCmgatSiY6e570I4wlVPZoJWDIBVZ 4d3NOt0y1JNUb9EE7da4nfYqndErkTJFW7NwkZliybB2WePhFd pEsaP1Wd01/PcrECtOvrHdnPgMOQmec4EPTSuZQjvaEFq2ehV6 Bt0fraaYFyo0oREUpSmYkIGwl6Z0oCSIOYpd2FreEQXtND6Hg= =
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2638.1362032972.2939.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1362032972 news.xs4all.nl 6908 [2001:888:2000:d::a6]:41015
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:40112

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How would you do this? eli m <techgeek201@gmail.com> - 2013-02-27 19:32 -0800
  Re: How would you do this? Dave Angel <davea@davea.name> - 2013-02-28 01:29 -0500
  Re: How would you do this? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-28 06:44 +0000
  Re: How would you do this? Michael Torrie <torriem@gmail.com> - 2013-02-27 23:52 -0700

csiph-web