Dave Angel wrote:
On 11/20/2011 04:45 PM, Steven D'Aprano wrote:
Something in the tool chain before it reached Python has saved it
using a wide (four byte) encoding, most likely UTF-16 as that is
widely used by Windows and Java. With the right settings, it could
take as little as opening th
Hi all,
I have wriiten the following code:
[Segment]
def survivor(names, step):
index = step - 1
next = names
while len(next)> 1:
next.remove (next[index])
However when ever i run it i get this error message:
Traceback (most recent call last):
File "", line 1, in
On Tue, Nov 22, 2011 at 12:28 AM, John wrote:
>
> Hi all,
>
> I have wriiten the following code:
> [Segment]
>
> def survivor(names, step):
>>>index = step - 1
>next = names
>while len(next)> 1:
>next.remove (next[index])
>
>
>
> However when ever i run it i get this e
On 22/11/11 05:28, John wrote:
def survivor(names, step):
index = step - 1
next = names
while len(next)> 1:
next.remove (next[index])
However when ever i run it i get this error message:
next.remove (next[index])
IndexError: list index out of range
Any ideas about whats causing this error?
On 11/22/2011 12:28 AM, John wrote:
Hi all,
I have wriiten the following code:
I can't provide any more clues about your code than the two excellent
replies you've already gotten. But it'd be really good if you could fix
your time machine, so you're not posting in the future. Really hard
Hi all,
I have attempted to create a programme which removes every Nth person
from the list until there is only one name remaining. N is inputted by
the user.
Here is the code:
def survivor(names, step):
next = names
while len(next) > 1:
index = step - 1
next.remove (next[i
John wrote:
Hi all,
I have wriiten the following code:
[Segment]
def survivor(names, step):
index = step - 1
next = names
while len(next)> 1:
next.remove (next[index])
What is the intention of this function? The name given doesn't mean
anything to me. The parameters
To answer your questions Steven
What is the intention of this function? The name given doesn't mean
anything to me. The parameters "names" and "step" don't seem meaningful.
I can see what the function does: it deletes bits of something, probably
a list, in a convoluted way, eventually causing
You're still posting from tomorrow.
On 11/22/2011 05:50 AM, John wrote:
Hi all,
I have attempted to create a programme which removes every Nth person
from the list until there is only one name remaining. N is inputted by
the user.
Here is the code:
def survivor(names, step):
next = nam
I'm trying to use a list comprehension to build a list with a variable
number of lists nested within it (ideally eventually going several
levels of nesting). However I seem to be observing some strange
behavior and was wondering if anyone could take a look at this and
tell me if what I'm trying to
Hello John,
You are still posting from the future. Please fix your computer so that
it is no longer set 12 hours in the future. Or perhaps your computer is
just set in the wrong time zone.
John wrote:
Hi all,
I have attempted to create a programme which removes every Nth person
from the
Charles Karl Becker wrote:
I'm trying to use a list comprehension to build a list with a variable
number of lists nested within it (ideally eventually going several
levels of nesting). However I seem to be observing some strange
behavior and was wondering if anyone could take a look at this and
nikunj.badja...@emc.com wrote:
Hi All,
Please look at the following snippet.
{{{
# User defined modules
try:
from scripts import precheck
from scripts import validate
from scripts import constants
except ImportError:
print("ERROR: One of the modules (..scripts/precheck.py, valid
It occurred to me last week while reviewing the files I made in using
Python, it could be somewhat similar to a database.
What would be a different between a Python files and Python databases?
Granted, the access in creating them are different, I really don't see
any different in the format o
On 11/21/2011 06:57 PM, Steven D'Aprano wrote:
Hello John,
You are still posting from the future. Please fix your computer so
that it is no longer set 12 hours in the future. Or perhaps your
computer is just set in the wrong time zone.
John wrote:
Hi all,
I have attempted to create a pro
On 22/11/11 00:24, Ken G. wrote:
It occurred to me last week while reviewing the files I made in using
Python, it could be somewhat similar to a database.
Depending on how broadly you define "database" you could be right.
What would be a different between a Python files and Python databases?
On 22/11/11 00:10, Steven D'Aprano wrote:
Because you don't have a list comprehension. You can't put add arbitrary
code inside a square brackets [ ]. You have to follow the syntax for a
list comprehension:
listcomp = [expression for name in sequence]
not
listcomp = [expression for name in seq
On 11/21/11, Ken G. wrote:
> It occurred to me last week while reviewing the files I made in using
> Python, it could be somewhat similar to a database.
>
> What would be a different between a Python files and Python databases?
> Granted, the access in creating them are different, I really don't s
On Tue, Nov 22, 2011 at 4:32 AM, Steven D'Aprano wrote:
> John wrote:
>
>>
>> Hi all,
>>
>> I have wriiten the following code:
>> [Segment]
>>
>> def survivor(names, step):
>
index = step - 1
>>next = names
>>while len(next)> 1:
>>next.remove (next[index])
>>
>
>
> W
Steven and Alan,
Thank you for your comments!
Alan said:
>> Because you don't have a list comprehension. You can't put add arbitrary
>> code inside a square brackets [ ]. You have to follow the syntax for a
>> list comprehension:
This helps me understand a lot when looking back, I thought that a
Alan, Steve, future readers,
After some re-reading and hacking I was able to discover the solution. Since I
raised the question here it is :
[['{0}'.format(x+1), x+1] for x in range(size)]
This will create the list with nested lists for whatever number 'size' is set
to. This should be good e
21 matches
Mail list logo