A[m] = j
choose (m+1)
Used [j] = False
choose (1)
Thanks
Logesh Pillay
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
] * n = []
I'd prefer not to use dummy values I have no use for. Is there any way?
Thanks
Logesh Pillay
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Dear list
I was really impressed by this version of quicksort:-
def qsort (t):
if len (t) == 0:
return []
else:
return qsort([x for x in t[1:] if x <= t[0]]) + [t[0]] +
qsort([x for x in t[1:] if x > t[0]])
I'm trying to produce something of a similar structure to generate the
Thanks Kent for your reply.
You said
This is a limitation of Python's nested scopes. You can't assign to a variable in an enclosing
scope. One way to work around this is to use a mutable value like a list in the enclosing scope:
def foo (n):
counter = [0]
def choose (i):
if (solution f
Hello list
I am having trouble with a variable to act as a counter in a nested
recursive function which will only occasionally find an answer.
Something like a static variable in C.
Why does this sort of thing not work?
def foo (n):
counter = 0
def choose (i):
if (solution found):
s strange but I have and idea it (or something similar)
worked when I last tried Python a yr or so ago. An earlier version of
Python?
Logesh Pillay
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor