[Tutor] Learning to program, not code.

Alan Gauld alan.gauld at btinternet.com
Fri Dec 19 11:27:24 CET 2014

On 19/12/14 02:09, Brandon Dorsey wrote:

> simple fact that I've been learning python for 8 months, and I have yet to
> start, and finish, a simple project.

That's a pity because the detail involved in completing a
project is often where you learn most.

Maybe you should take time out from "learning" to concentrate
on finishing one simple project. Make a start and when you get
stuck, ask here.

> I find difficult to not only visualize the execution, but to
> figure out when and where to use data structure 'x'.

The base data structures of list, tuple, set, dictionary all have fairly 
specific uses.

- Sets are collections of unique values
- Lists are numerically indexed, mutable collections of values
- Tuples are numerically indexed, immutable collections of values
- Dictionaries are keyed, mutable collections of values.

Often you can use any one of list, tuple or dictionary...
Use a tuple if it won't be changing.
Use a dictionary if you have a natural key value
Otherwise use a list

Classes are a special case and are best discussed separately
if that's where you are struggling. You don't need classes
for most simple projects.

> Any suggestions on how to approach programming
> from a different angle?

You could try designing the program before you start. Often jumping into 
code too soon leads to confusion. Do you have any method of structuring 
your code before you start? (For example using
pdeudo-code or flow charts?)

For a completely different approach to designing code (using
Scheme but applicable to Python too) take a look at the web
site/ebook "How to Design Programs"


This is particularly helpful if your problems tend to
be algorithmic in nature rather than data store focused.

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list