On 31/05/14 10:23, Sasi - wrote:
Hi, i tried to make a code to execute the functions that i described
below. However i got a break outside the loop error

Always post the full error message it usually contains
lots of useful detail.

## Created the lists for brain and plasma before searching for common
bioseq.
while True:
     count1 += 1
     s1=file1.readline().partition(',')[0]
if s1 and count1 > 1:

This line is not indented so the loop stops on
the previous line.


         brain.append(s1)
         if not s1:
                 break

But your 'break' is here so it is outside the loop.

You need to indent the whole section from

if s1 and count1 > 1:

so that it is inside the loop.


while True:
     count2 += 1
     s2=file2.readline().partition(',')[0]
if s2 and count2 > 1:
         plasma.append(s2)
         if not s2:
                 break

And the same problem here.
The indentation defines what is inside the loop.

HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to