We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Print a Report

Our data is organized; now it's time to print a pretty report!

The character-count dictionary includes spaces, punctuation, and other symbols that don't belong in the report. We can filter those out using the str.isalpha() method, which returns True when a string is non-empty and all of its characters are alphabetic:

"a".isalpha()
# True

"!".isalpha()
# False

Assignment

Print the report in this format:

============ BOOKBOT ============
Analyzing book found at books/frankenstein.txt...
----------- Word Count ----------
Found 75767 total words
--------- Character Count -------
e: 44538
t: 29493
a: 25894
o: 24494
i: 23927
n: 23643
s: 20360
r: 20079
h: 19176
d: 16318
l: 12306
m: 10206
u: 10111
c: 9011
f: 8451
y: 7756
w: 7450
p: 5952
g: 5795
b: 4868
v: 3737
k: 1661
x: 691
j: 497
q: 325
z: 235
æ: 28
â: 8
ê: 7
ë: 2
ô: 1
============= END ===============
    • It should take the book path, word count, and sorted list of character counts as inputs.
    • Loop over the sorted list of characters.
    • Use str.isalpha() to skip non-alphabetic characters.
    • Print each alphabetic character and its count in the format shown above.

Run and submit the CLI tests from the root of your project.