4
I need to do Python programming to know the CG percentage in a DNA string...
maior = 0
dnaMaior = ""
while True:
dna = input("Digite uma sequencia de DNA: ")
if dna == "Z" or dna == "z":
break
else:
tam = len(dna)
indice = 0
while indice < len(dna):
if dna == "C" or dna == "G":
C = C + 1
G = G + 1
indice = indice+1
percCG = ((C+G)*100)/len(dna)
maior = percCG
dnaMaior = dna
print(dnaMaior)
There is a syntax error. Why this error occurs, and how to fix it?
Digite uma sequencia de DNA: CCCCCCCGGGGGGGGAAAAAAAATTTT Traceback (most recent call last): File "C:/Users/13104855/Downloads/exerc_02T2.py", line 18, in <module> percCG = ((C+G)*100)/len(dna) NameError: name 'C' is not defined