|
Re: forget my other post, read this one
|
Posted: Jul 16, 2004 11:22 AM
|
|
The two posts asking for help writing this program are great examples of typical problems confronting programmers.
1. Incomplete (in this case nonexistent) description of the problem. I've read all of the posts more than once and I can't figure out what the problem is, or what a solution will look like. I could be dense, but I'm guessing that no one is posting helpful solutions because they don't know what the problem is either.
2. Diving into implementation too soon. With no clear description of the problem, or how to solve it, the programmer has put together an implementation, then gotten bogged down with problems in that implementation. Instead of discussing the problem and the data structures and algorithms that might be used to solve the problem, the programmer is asking for help with language and semantic issues.
3. The data structures are clearly poorly chosen and are driving the implementation. Like most modern languages Python has data structures like lists and tuples that are frequently better choices than variables named p1, p2, etc. And the code begs for some generality that would be obvious with more appropriate data structures.
4. Learning just enough of the language to drive into a dead-end. Loops, lists, functions, etc. are all available in Python to make life easier. Spending the time to learn the language will pay off.
On top of all that I suspect that when the problem is defined someone will recognize it as a textbook algebra or calculus problem that doesn't need a computer program to exhaustively search for a solution.
Greg Jorgensen PDXperts LLC, Portland, Oregon USA
|
|