Question: with open(the.txt) as ecoli: from collections import defaultdict counts = defaultdict(int) for line in ecoli: if line.startswith(>): continue for char in line: if char in

with open("the.txt") as ecoli:

from collections import defaultdict

counts = defaultdict(int)

for line in ecoli:

if line.startswith(">"):

continue

for char in line:

if char in {"A", "C", "D", "E", "F", "G", "H", "I", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "Y"}:

counts[char] += 1

total = float(sum(counts.values()))

for key,val in counts:

print ("{}: {}, ({:.1%})".format(key,val, val / total))

Can someone please expain to me how would you go about taking the results (below) and orgazing them in terms of percentage??? As in, I want the highest percetage on the top and lowest on the bottom.

THANKS

Results:

G: 95475 (7.4%) F: 50554 (3.9%) I: 77836 (6.0%) H: 29255 (2.3%) K: 57151 (4.4%)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!