ich soll aus einer raw_input liste die anzahl an elementen herauslesen welche a, c, g oder t sind (DNA-Strang)
ich hab bereits eine kleinere Lösung gemacht aber habe da das problem, dass mein DNA stück genau 10 zeichen haben muss. und dass die Programmierung doch ehere langwiirig ist. könnt ihr mir vielleicht nen kleinen schubs in die richtige richtung geben?
ich post soweis schonmal was ich habe um zu zeigen wo mein problem liegt:
Code: Alles auswählen
lista = []
list_ = "caagttagca"
if list_[0] == "a":
lista.append(1)
if list_[1] == "a":
lista.append(1)
if list_[2] == "a":
lista.append(1)
if list_[3] == "a":
lista.append(1)
if list_[4] == "a":
lista.append(1)
if list_[5] == "a":
lista.append(1)
if list_[6] == "a":
lista.append(1)
if list_[7] == "a":
lista.append(1)
if list_[8] == "a":
lista.append(1)
if list_[9] == "a":
lista.append(1)
a = len(lista)
prozenta = 100*(a/(a))
print a
print "A:", prozenta, "%"
print lista
greez menace