Re: [Tutor] if >= 0

2014-02-14 Thread ALAN GAULD
CCing the list. Please use Reply All when responding. > thanks Alan, i understand now zero is False.  That's right. but... > so if one of the 'if' test is false, that 'for' loop is also halted?  > and does not proceed to the next element? This bit  is wrong. The for loop will continue to comp

Re: [Tutor] if >= 0

2014-02-11 Thread rahmad akbar
Alan, roger that and thanks a bunch. now replying with reply all, i am a super noob and thanks for the kind adivce On Tue, Feb 11, 2014 at 10:31 AM, ALAN GAULD wrote: > CCing the list. Please use Reply All when responding. > > > thanks Alan, i understand now zero is False. > > That's right. but

Re: [Tutor] if >= 0

2014-02-10 Thread ALAN GAULD
CCing Tutor list.   here are the entire code  > > >import sys >in_file = open(sys.argv[1], 'r').readlines() >locus = '' >accession = '' >organism = '' > >OK, as suspected you initialise these to empty strings so they almost >certainly  are being printed they just don't contain anything. Its easily

Re: [Tutor] if >= 0

2014-02-10 Thread Alan Gauld
On 10/02/14 15:32, rahmad akbar wrote: hey again guys, i am trying to understand these statements, if i do it like this, it will only print the 'print locus' part for element in in_file: if element.find('LOCUS'): locus += element The only time this is not executed is if LOCUS is at th

Re: [Tutor] if >= 0

2014-02-10 Thread Joel Goldstick
On Feb 10, 2014 10:33 AM, "rahmad akbar" wrote: > > hey again guys, i am trying to understand these statements, > > if i do it like this, it will only print the 'print locus' part > > for element in in_file: # do this print element > if element.find('LOCUS'): > locus += element >

Re: [Tutor] if >= 0

2014-02-10 Thread Peter Otten
rahmad akbar wrote: > hey again guys, i am trying to understand these statements, > > if i do it like this, it will only print the 'print locus' part > > for element in in_file: > if element.find('LOCUS'): > locus += element > elif element.find('ACCESSION'): > accession += element >

[Tutor] if >= 0

2014-02-10 Thread rahmad akbar
hey again guys, i am trying to understand these statements, if i do it like this, it will only print the 'print locus' part for element in in_file: if element.find('LOCUS'): locus += element elif element.find('ACCESSION'): accession += element elif element.find('ORGANISM'): orga