Re: [Tutor] indexing a list

2012-10-18 Thread eryksun
On Thu, Oct 18, 2012 at 8:01 AM, Spyros Charonis wrote: > > x = 21 # WINDOW LENGTH > > In [70]: SEQ[0:x] > Out[70]: 'MKAAVLTLAVLFLTGSQARHF' > > In [71]: SEQ[x:2*x] > Out[71]: 'WQQDEPPQSPWDRVKDLATVY' > > In [72]: SEQ[2*x:3*x] > Out[72]: 'VDVLKDSGRDYVSQFEGSALG' > > How could I write a function to

Re: [Tutor] Indexing a list with nested tuples

2011-08-05 Thread Alexander Quest
My bad- meant to say [1]. Thanks. -Alexander On Fri, Aug 5, 2011 at 12:36 PM, Christopher King wrote: > > > On Tue, Aug 2, 2011 at 10:44 PM, Alexander Quest wrote: >> >> have [0] to indicate that I want to go to the second value within that >> first item, which is the >> point value >> > Actuall

Re: [Tutor] Indexing a list with nested tuples

2011-08-05 Thread Christopher King
On Tue, Aug 2, 2011 at 10:44 PM, Alexander Quest wrote: > > have [0] to indicate that I want to go to the second value within that > first item, which is the > point value > Actually [0] is the first element. I would go with [1]. ___ Tutor maillist - Tu

Re: [Tutor] Indexing a list with nested tuples

2011-08-03 Thread Alexander Quest
Hi Bob- thanks for the reply again. I apologize about not "replying all" last time- still getting in the habit of doing this. I am using Python version 3.1. As far as tuples are concerned, I don't NEED to use them, but I am trying to get some practice with them. This is because I am following an i

Re: [Tutor] Indexing a list with nested tuples

2011-08-03 Thread Alexander Quest
Thanks Peter- I tried the replacement method where the entire tuple is replaced with a new one and that worked. Changing the "attribute_index" (or "selection" variable, as I called it) to an integer removed the int/str errors. -Alex On Wed, Aug 3, 2011 at 12:12 AM, Peter Otten <__pete...@web.de>

Re: [Tutor] Indexing a list with nested tuples

2011-08-03 Thread bob gailer
On 8/2/2011 11:39 PM, Alexander Quest wrote: Hey Bob- thanks for the reply. Here is a more complete part of that code section (the ellipses are parts where I've deleted code because I don't think it's important for this question): Please always reply-all so a copy goes to the list. Thanks for

Re: [Tutor] Indexing a list with nested tuples

2011-08-03 Thread Peter Otten
Alexander Quest wrote: > Hi guys- I'm having a problem with a list that has nested tuples: > > attributes = [("strength", 0), ("health ", 0), ("wisdom ", 0), > ("dexterity", 0)] > > I've defined the list above with 4 items, each starting with a value of 0. > The player > enters how many points

Re: [Tutor] Indexing a list with nested tuples

2011-08-02 Thread bob gailer
On 8/2/2011 10:44 PM, Alexander Quest wrote: Hi guys- I'm having a problem with a list that has nested tuples: attributes = [("strength", 0), ("health ", 0), ("wisdom ", 0), ("dexterity", 0)] I've defined the list above with 4 items, each starting with a value of 0. The player enters how m

Re: [Tutor] Indexing a List of Strings

2011-05-18 Thread spawgi
Agreed that your original sequences are 1000 char long. But it helps to understand the problem better if you can give examples with smaller strings. Please can you post smaller examples? This will also help you test your code on your own inputs. On Wed, May 18, 2011 at 5:40 AM, Spyros Charonis wro

Re: [Tutor] Indexing a List of Strings

2011-05-17 Thread Alan Gauld
"Spyros Charonis" wrote for item in finalmotifs: for line in my_list: if item in line: print line.index(item) But this only returns a single number (e.g 119), which is the index at which my sequence begins. Is it possible to get a pair of indices that indicate beginnin