Gente, nãoNão consigo entender porque no fim essa função não retorna uma string. O erro fica em fptr.write(result + '\n')fptr.write(result + '\n')
, como se a função retornasse um objeto do tipo NoneNone
.
complement = []
complement0 = reversed(s)
for character in complement0:
if character == 'G':
complement.append('C')
elif character == 'C':
complement.append('G')
elif character == 'A':
complement.append('T')
elif character == 'T':
complement.append('A')
final = ''.join(complement)
print(final)
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
s = input()
result = str(dnaComplement(s))
fptr.write(result + '\n')
fptr.close()
def dnaComplement(s):
complement = []
complement0 = reversed(s)
for character in complement0:
if character == 'G':
complement.append('C')
elif character == 'C':
complement.append('G')
elif character == 'A':
complement.append('T')
elif character == 'T':
complement.append('A')
final = ''.join(complement)
print(final)
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
s = input()
result = str(dnaComplement(s))
fptr.write(result + '\n')
fptr.close()