On 17/06/14 19:52, keith papa wrote:


Hi, I want to no what some tips or information you can give me to
> remember some of the rules of python,
> when you first start learning programming?


Most of my tips/rules are about programming rather than python...
-----------------------------------------------------------------
Use for loops when you know (or can predict) the number of iterations.
Use while loops when you don't know in advance

Put repeating code in a function

Use meaningful variable names.

Use dictionaries more often.

Let the data define the structure.
And structure your data so that it can.

And more Python specific:
-------------------
Use modules instead of singleton classes

Use "if/elif" instead of "if/else if" trees

Variables are just names bound to objects

Don't test types, use the interface


Is that the kind of thing?

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to