[ale] simple python question

Thomas Stromberg lists at stromberg.org
Thu Jan 10 18:17:16 EST 2008


The easiest way to explore things like this is to just open up the
interactive python interpreter, by typing 'python' on your command
line. Then you can enter things in as you please:

>>> for i in range(4):
...   print i
...
0
1
2
3

Or lookup docs:

>>> help(range)

range(...)
   range([start,] stop[, step]) -> list of integers

   Return a list containing an arithmetic progression of integers.
   range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.
   When step is given, it specifies the increment (or decrement).
   For example, range(4) returns [0, 1, 2, 3].  The end point is omitted!
   These are exactly the valid indices for a list of 4 elements.

I recommend Dive Into Python as a good beginners treatment for the
language. Good luck! There is also the Atlanta Python Meetup group:
http://python.meetup.com/46/


-- 
sig={'website': 'http://sprocket.io/', 'phone': '678-608-0428'}

On Jan 10, 2008 5:57 PM, Greg Freemyer <greg.freemyer at gmail.com> wrote:
> All,
>
> I know c code, but not python.
>
> I'm looking a little supervisor app that I need to have a basic
> understanding of.
>
> So what does 'for i in range(4):" do?
>
> something like
>    for (i=0, i<4; ++i)
>
> Thanks
> Greg
> --
> Greg Freemyer
> Litigation Triage Solutions Specialist
> http://www.linkedin.com/in/gregfreemyer
> First 99 Days Litigation White Paper -
> http://www.norcrossgroup.com/forms/whitepapers/99%20Days%20whitepaper.pdf
>
> The Norcross Group
> The Intersection of Evidence & Technology
> http://www.norcrossgroup.com
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>



More information about the Ale mailing list