I am experimenting with using different booleans to get the same results. I have two functions and I don't understand why one works and the other doesn't.
This works:
dna='ATGTGGTAG'
def orf_4(dna):
if dna[len(dna)-3:]=='TGA' or dna[len(dna)-3:]== 'TAG' or dna[len(dna)-3:]=='TAA':
return 'This could be an ORF'
else:
return 'This is not an ORF'
print orf_4(dna)
This does not. It returns 'This is not an ORF' for any input.
dna='ATGTGGTAG'
def orf_3(dna):
if dna[len(dna)-3:]!='TGA' or dna[len(dna)-3:]!= 'TAG' or dna[len(dna)-3:]!='TAA':
return 'This is not an ORF'
else:
return 'This could be an ORF'
print orf_3(dna)
Does anybody have a suggestion as to why this is?
Aucun commentaire:
Enregistrer un commentaire