oops, wrong address.<br><br>When will reply-to tag appear on the Python mailing list? =/<br><div class="gmail_quote"><br>Good idea, Steven and MRAB.<br><br>I changed my code to the following:<div class="im"><br><br> def nPrime(self, n):<br>
"Returns nth prime number, the first one being 2, where n = 0. When n = 1, it returns 3."<br></div> for x in range(n+2):<div class="im"><br>
try:<br> return self.primes[n]<br></div> except IndexError:<br> self.next()<br><br>And it's definitely better. Thanks a ton guys.<br><br>(n+2 because after looping the maximum number of times, it needs to try returning the value again.)<br>
<br>It works just as well as the previous version, but slightly safer on my part... and I can adapt this in my future coding habits.<br><br>Thanks again.<div><div></div><div class="h5"><br><br>Ching-Yun "Xavier" Ho, Technical Artist<br>
<br>Contact Information<br>
Mobile: (+61) 04 3335 4748<br>Skype ID: SpaXe85<br>Email: <a href="mailto:contact@xavierho.com" target="_blank">contact@xavierho.com</a><br>Website: <a href="http://xavierho.com/" target="_blank">http://xavierho.com/</a><br>
</div></div></div><br>