On Wed, 18 Oct 2006, kumar s wrote:
> I am not sure if I got your opinion about the way I solved.
Hi Kumar,
I was replying to your question:
http://mail.python.org/pipermail/tutor/2006-October/050064.html
in which you showed a program that had problems. I'm assuming that you
haven't f
Thank you Danny. I am going over your email and trying
to understand (i am a biologist with bioinformatics
training).
I am not sure if I got your opinion about the way I
solved. do you mean that there is something wrong with
the way i solved it.
I am not sure If I explained the problem correctl
On Mon, 16 Oct 2006, kumar s wrote:
> I have a simple question to ask tutors:
>
> list A :
>
> a = [10,15,18,20,25,30,40]
Hi Kumar,
If you're concerned about correctness, I'd recommend that you try thinking
about the problem inductively. An inductive definition for what you're
asking is st
In continuation to :
Re: [Tutor] extracting numbers from a list
hello list
I have coordinates for exons (chunks of sequence). For
instance:
10 - 50 A
10 - 20 B
35 - 50 B
60 - 70 A
60 - 70 B
80 - 100 A
80 - 100 B
(The above coordinates and names are easier than in
dat)
Here my aim is to
On 17/10/06, Asrarahmed Kadri <[EMAIL PROTECTED]> wrote:
> My solution : (i have tested it)
As long as we're all taking turns, what about a functional approach:
>>> a = [10, 15, 18, 20, 25, 30, 40]
>>> def pairs(lst):
... return list.__add__([(lst[0], lst[1])], zip(map((1).__add__,
lst[1:]), lst
I agree.
Regards,
Asrar
On 10/17/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
Asrarahmed Kadri wrote:> My solution : (i have tested it)>>> list1 = [10,15,18,20,25,30,40]
>> for i in range(len(list1)-1):> print list1[i],list1[i+1]> list1[i+1] += 1Note that this changes the original list, w
Asrarahmed Kadri wrote:
> My solution : (i have tested it)
>
>
> list1 = [10,15,18,20,25,30,40]
>
> for i in range(len(list1)-1):
> print list1[i],list1[i+1]
> list1[i+1] += 1
Note that this changes the original list, which may or may not be
acceptable. Normally you would expect a p
My solution : (i have tested it)
list1 = [10,15,18,20,25,30,40]
for i in range(len(list1)-1): print list1[i],list1[i+1] list1[i+1] += 1
Note:
# print the consecutive elements; for the first pass of the loop the elements are unchanged, for the remaining we add one.
On 10/16/06, kumar
"wesley chun" <[EMAIL PROTECTED]> wrote in message
> look very carefully at variables 'fy' vs. 'last', what you do with
> them, and when, and you should be able to figure out your homework
> assignment problem.
Hmmm, "homework assignment" was probably what I was missing
Alan G.
___
"kumar s" <[EMAIL PROTECTED]> wrote
> a = [10,15,18,20,25,30,40]
>
> I want to print
> 10 15 (first two elements)
> 16 18 (16 is last number +1)
> 19 20
The simplest solution would seem to be a while loop:
print a[0], a[1] # special case
index = 1
while index < len(a):
print a[index-1]+1, a[
On 10/16/06, kumar s <[EMAIL PROTECTED]> wrote:
hi :I have a simple question to ask tutors:list A :a = [10,15,18,20,25,30,40]I want to print10 15 (first two elements)16 18 (16 is last number +1)19 2021 2526 3031 40
>>> fx = a[0]>>> fy = a[1]>>> b = a[2:]>>> ai = iter(b)>>> last = ai.next()>>> for j
> I want to print
> 10 15 (first two elements)
> 16 18 (16 is last number +1)
>:
> >>> fx = a[0]
> >>> fy = a[1]
> >>> b = a[2:]
> >>> ai = iter(b)
> >>> last = ai.next()
> >>> for j in ai:
> ... print fy+1,last
> ... last = j
> ...
> 16 18
> 16 20
> 16 25
> 16 30
look very carefully a
hi :
I have a simple question to ask tutors:
list A :
a = [10,15,18,20,25,30,40]
I want to print
10 15 (first two elements)
16 18 (16 is last number +1)
19 20
21 25
26 30
31 40
>>> fx = a[0]
>>> fy = a[1]
>>> b = a[2:]
>>> ai = iter(b)
>>> last = ai.next()
>>> for j in ai:
... print fy+1,l
13 matches
Mail list logo