Hey everyone, I have this small piece of code that simply finds the
factors of a number.
import sys
def factor(n):
primes = (6*i+j for i in xrange(1, n) for j in [1, 5] if (i+j)%5 !
= 0)
factors = []
for i in [2, 3, 5]:
while n % i == 0:
n /= i
:15 PM, Terry Reedy wrote:
Cameron Pulsford wrote:
When you start a new thread, you should start a new thread and not
piggyback on an existing thread.
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list
was initially looking at it there are some interesting patterns
I might be able to extend into a generator that would yield only
correct sets of numbers for the 6x + n pattern.
On Jul 12, 2009, at 10:26 PM, John Machin wrote:
On Jul 13, 11:24 am, Cameron Pulsford cameron.pulsf...@gmail.com
wrote
Hello all, I'm redoing a sudoku solver of mine and I ran into an issue with
lists of dicts. Bear with me for a second before I get to the actual
problem... I'm representing the board as a dictionary, where the keys are
(x, y) positions, and the values are candidates. So my program goes along
Hey all, I have a dictionary that looks like this (small example version)
{(1, 2): 0} named a
so I can do a[1,2] which returns 0. What I also have is a list of
coordinates into a 2 dimensional array that might look like this b =
[[1,2]]. Is there anyway I can call a[b[0]] and have it return 0?
--
Thanks!
On Tue, Jun 23, 2009 at 11:29 AM, Jaime Fernandez del Rio
jaime.f...@gmail.com wrote:
On Tue, Jun 23, 2009 at 4:45 PM, Cameron
Pulsfordcameron.pulsf...@gmail.com wrote:
Hey all, I have a dictionary that looks like this (small example version)
{(1, 2): 0} named a
so I can do
Hey all, hopefully a simple question.
I'm writing a simple python tool that opens a file, and does something like
for line in file.readlines():
temp.write(line.doStuff())
However, I want to provide the option do this in place, as in have the
destination file be the same as the source file.
:
Cameron Pulsford wrote:
Hey all, hopefully a simple question.
I'm writing a simple python tool that opens a file, and does something
like
for line in file.readlines():
temp.write(line.doStuff())
However, I want to provide the option do this in place, as in have the
destination file
Sorry to flood the list but my google fu isn't up to par today I guess.
Basically, is it possible to read the permissions on one file and then set
the permissions of another file to the ones we just read? os.dup2 seemed
like it would work but I might not be using it correctly.
I know there is
Hey everyone, I am extremely stumped on this. I have 2 functions..
def _determinant(m):
return m[0][0] * m[1][1] - m[1][0] * m[0][1]
def cofactor(self):
Returns the cofactor of a matrix.
newmatrix = []
for i, minor in enumerate(self.minors()):
Thanks, that did it! Why is that the case though? Or rather, why do
the assignments to temp.x and temp.y not effect the self.x and self.y?
How come I only run into the problem with the list?
On Feb 12, 2009, at 5:15 PM, andrew cooke wrote:
you're setting the new knight's sl to the value
11 matches
Mail list logo