Because 0 is counted therefore i only have to do it 99 times<br><br>Thanks<br><br><div class="gmail_quote">On Feb 3, 2008 4:38 AM, Gabriel Genellina <<a href="mailto:gagsl-py2@yahoo.com.ar">gagsl-py2@yahoo.com.ar</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">En Sun, 03 Feb 2008 01:03:43 -0200, James Matthews <<a href="mailto:nytrokiss@gmail.com">nytrokiss@gmail.com</a>><br>
escribió:<br><br>Sorry to be nitpicking, but people coming from other languages may get<br>confused by the wrong examples:<br><div class="Ih2E3d"><br>> What i do is a simple range call. for i in range(number of times i want<br>
> to repeat something)<br>> I guess it comes from my C days for(i=0;i<100;i++) { or in python for i<br>> in range(99):<br><br></div>Should be `for i in range(100)` to match exactly the C loop. Both iterate<br>
100 times, with i varying from 0 to 99 inclusive.<br><div class="Ih2E3d"><br>>>  <a href="mailto:miller.paul.w@gmail.com">miller.paul.w@gmail.com</a> wrote:<br>>><br>>> > Ruby has a neat little convenience when writing loops where you don't<br>
>> > care about the loop index: you just do n.times do { ... some<br>>> > code ... } where n is an integer representing how many times you want<br>>> > to execute "some code."<br>>> ><br>
>> > In Python, the direct translation of this is a for loop.  When the<br>>> > index doesn't matter to me, I tend to write it as:<br>>> ><br>>> > for _ in xrange (1,n):<br>>> >    some code<br>
<br></div>Should be `for _ in xrange(n)` to match the Ruby example. Both iterate n<br>times.<br><div class="Ih2E3d"><br>> On Feb 3, 2008 3:34 AM, Roy Smith <<a href="mailto:roy@panix.com">roy@panix.com</a>> wrote:<br>
><br></div><div class="Ih2E3d">>> But, more to the point, I'd try to find variable name which described<br>>> why I was looping, even if I didn't actually use the value in theloop<br>>> body:<br>
<br></div>Me too. Government don't collect taxes by the number of variable names<br>used (yet).<br><br>--<br>Gabriel Genellina<br><font color="#888888"><br>--<br></font><div><div></div><div class="Wj3C7c"><a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><a href="http://search.goldwatches.com/?Search=Movado+Watches">http://search.goldwatches.com/?Search=Movado+Watches</a> <br><a href="http://www.jewelerslounge.com">http://www.jewelerslounge.com</a><br>
<a href="http://www.goldwatches.com">http://www.goldwatches.com</a>