[Tutor] question already discussed with oscar benjamin
Linsey Raaijmakers
lm.raaijmakers at gmail.com
Tue May 7 22:10:49 CEST 2013
Hi,
Im trying to work with the help Oscar provided me, but I still get stuck :(
So what I'm trying to do now is write the program with the following input
and output:
Input:
action,start,apex,stop
3, 12, 13, 15
4, 15, 15, 15
3, 20, 21, 25
5, 21, 23, 30
...
And when you run your program it prints out:
actions, start, stop
[3], 12, 13
[], 14,15
[4], 15, 15
[], 16, 19
[3], 20, 21
[3, 5], 21, 21
[5], 22, 23
...
I don't want to use the stop. Only the start till apex is important.
This is the code I have now:
now = onset_list[0]
end = apex_list[0]
active = action_list[0]
for i in range(1,len(onset_list)):
next_start = onset_list[i]
next_end = apex_list[i]
next_active = action_list[i]
prev_end = apex_list[i-1]
while next_start > end:
print active+"\t"+now+'\t'+end
end = next_end
now = next_start
active = next_active
print active+','+next_active+'\t'+now+'\t'+next_end
But my output will print now:
3 12 13
4,4 15 15
4 15 15
3,3 20 21
3,5 20 25
How do I fix that it doesn't print out the double ones?
I'm sorry that I can't figure it out without your help. Im really trying..
:(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130507/1a82334c/attachment-0001.html>
More information about the Tutor
mailing list