list= [
...,
2648, 2648, 2648, 63370, 63370, 425, 425, 120,
120, 217, 217, 189, 189, 128, 128, 115, 115, 197,
19752, 152, 152, 275, 275, 1716, 1716, 131, 131,
98, 98, 138, 138, 277, 277, 849, 302, 152, 1571,
68, 68, 102, 102, 92, 92, 146, 146, 155, 155,
9181, 9181, 474, 449, 98, 98, 59, 59, 295, 101,
...
]
for i in list:
if int(i/50)+1 not in dic:
dic(int(i /50)+1)=list.count(i)
else:
dic(int(i /50)+1)+=list.count(i)
我这么写总是报错,我想以 50bp 为一个区间进行统计,即统计长度在 0-50 的频数,50-100 的频数...
我这么写对么,应该怎么写呢?
Result:
Don’t use built-in function names:
list
as variable namesThe ranges you want overlap. For example, the element 50 does not know whether it should be divided into 0-50 or 50-100
To access the dictionary you should use
[]
而不是()
Questions I answered: Python-QA
for i in list i is the content in the list, it should be for I in range(len(list))