Completed 10-10 Common Words

This commit is contained in:
cheeks 2025-03-06 00:33:58 +00:00
parent c7cb0c5bde
commit 15d3729776
4 changed files with 116805 additions and 0 deletions

View File

@ -0,0 +1,28 @@
# Exercise 10-10 Common Words
# Learning Objective: Take a free ebook and gather data on how many times a word is found within it.
from pathlib import Path
book1 = Path("./Chapter_10/bible.txt")
bible = book1.read_text()
print("\n\nKing James Version Bible Stats:\n")
print(f"THERE: {bible.lower().count('there')}")
print(f"THEM: {bible.lower().count('them')}")
print(f"THE: {bible.lower().count('the')}")
print(f"THE : {bible.lower().count('the ')}")
book2 = Path("./Chapter_10/scientific_american_vol_37.txt")
sciam = book2.read_text()
print("\n\nScientific American, Vol XXXVII STATS:\n")
print(f"THERE: {sciam.lower().count('there')}")
print(f"THEM: {sciam.lower().count('them')}")
print(f"THE: {sciam.lower().count('the')}")
print(f"THE : {sciam.lower().count('the ')}")
book3 = Path("./Chapter_10/the_manufacture_of_paper.txt")
paper = book3.read_text()
print("\n\n THE MANUFACTURE OF PAPER STATS:\n")
print(f"THERE: {paper.lower().count('there')}")
print(f"THEM: {paper.lower().count('them')}")
print(f"THE: {paper.lower().count('the')}")
print(f"THE : {paper.lower().count('the ')}")

99968
Chapter_10/bible.txt Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff