How to score how densely bases are distributed along a given oligo? Suppose I have a short chain string of oligos, and I want to rate them from 0 to 1 based on how clustered the "A"s are in respect to the chain. For example:

"AAAAACCCCC" #should score as 1 for being as clustered as it possibly could
"ACACACACAC" #should be scored as 0 for being as thinly distributed as it could


Current idea is to strip both ends of A's, then remove first and last characters, then 

gaps = ''.join(str(x) for x in deck).split("A")
listofCs = [x for x in gaps if x] 


to join it all together as a list of how big the gaps are (i.e. the "C"s), and simply count the average size 

average = sum(map(len,listofCs))/len(listofCs)


But I feel like there should be a much more elegant solution to this. It feels messy. How can I improve the scoring?
You could count the number of transitions between an A and a 'not A', and divide this number by the total number of As.  You might also need to scale by the sequence length, if you have different length sequences that you want to compare.

Edit: also, there might be a correction to make if one or both ends of the sequence are an A