I'm trying to find a way to print the index of each 'A' in this DNA string.
Tried:
dna = 'ATCACGACGTGACGGATCGAGCAGTACG'
for nuc in dna:
if nuc == 'A':
print (dna.index(nuc))
Output:
0
0
0
0
0
0
0
0
Which I understand is because the index of the first 'A' is 0. What I'm trying to figure out is if it's possible to use a for loop to print the index of each individual 'A' in the string (so I know where each 'A' is in the string).