Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

What are the various types of investments?

Answered: 1 week ago