例子:Enter DNA : ACRSASA=2C=1R=2S=2我想讓這個(gè)函數(shù)像字典和排序的例子一樣。sequence=input("Enter DNA: ")sequence_1=sequence.uppersequence_list=list(sequence_1)到目前為止我已經(jīng)編寫了該函數(shù)。我怎樣才能打印這樣的例子?
2 回答

瀟瀟雨雨
TA貢獻(xiàn)1833條經(jīng)驗(yàn) 獲得超4個(gè)贊
我希望這會起作用......
from collections import Counter sequence=input("Enter DNA: ") sequence_1=sequence.upper() sequence_list= list(sequence_1)print(Counter(sequence_list))

縹緲止盈
TA貢獻(xiàn)2041條經(jīng)驗(yàn) 獲得超4個(gè)贊
這應(yīng)該會給你想要的結(jié)果:
for element in sorted(set(sequence_1)) print(element +"=" + str(sequence_1.count(element)))
添加回答
舉報(bào)
0/150
提交
取消