[Tutor] problem solving with lists

Alan Gauld alan.gauld at yahoo.co.uk
Mon Mar 7 06:24:20 EST 2022


On 07/03/2022 07:44, marcus.luetolf at bluewin.ch wrote:

> I should have written ... c) if my problem can by solved with python or any
> other programming language at all.

Python, or any other "Turing complete" programming language can
represent any algorithm you come up with. So the answer is yes,
once you have the algorithm.

> It's the process of finding an algorithm to solve my task I am stuck with

And that is often the hardest bit.

> I'am very gratefull for your advice to reduce the task to 9 items/letters in
> sublists of 3 (soem sort of recursion ?)
> but it doesn't get me any further.

Can you solve it by hand? - ie. using a pencil and paper.
If not then you don't really understand your problem yet.
So you need to write down all the different conditions
that must be met, including all the exceptional cases
that might arise.

Once you understand what needs to be done you should be
able to work out how to do it using pencil and paper.

That will give you an algorithm. It may not be the most
efficient, and it will likely not be generalized to
"N sublists from M" elements yet. But it is a start.

But unless you understand the solution at that level
you are unlikely to be able to write a program to
solve it. (Unless it's a swell known algorithm and
you can find a library. But it looks as if your
requirements are slightly different from the more
common cases)

We can certainly help you formulate the required
algorithm, and possibly some shortcuts. But you
need to give us a complete and precise description
of the problem.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list