"Paul Melvin" <[EMAIL PROTECTED]> wrote

For example, if I generate some numbers using range the only way I could easily sum them was to append them to a list and then call the sum function,
if I tried without the list I couldn't sum them at all.

Lots of good general answers but specifically for a range try:

print sum( range(3,7) )
18

ie range() returns the numbers already in a list you don't
need to append them to another list.


BTW If you haven't already, take a look at my tutorial.
It compares Python to VBScript which is a modern version of Basic
It may bring back some of your old menories and help translate
those to Python.

HTH

--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to