12 Teach: Team Activity
Overview
In this activity, you will practice finding items in a file. You will be supplied with a file that contains the books in the Standard Works of the Scriptures, and for each book the number of chapters. You will need to open this file, parse through it, and discover books that have certain properties.
Assignment
Download the file: books_and_chapters.txt and save it to a folder for your project. Then, open that folder in VS Code and create a Python script to read through the file line by line.
Take a minute to look at the file, understand the type of data it contains, and what character you'll need to split on to separate it into the proper pieces.
Core Requirements
Work through these core requirements step-by-step to complete the program. Please don't skip ahead and do the whole thing at once, because others on your team may benefit from building the program up slowly.
-
Open the file, read through it line by line, separate the line into the appropriate pieces and display each book in this format:
Scripture: Old Testament, Book: Genesis, Chapters: 50
Find the largest number of chapters in the scriptures.
Find the book that has the largest number of chapters in the scriptures.
Stretch Challenge
Change your program so that it only prints the books in the Book of Mormon.
Find the book in the Book of Mormon that has the largest number of chapters.
At the beginning of the program, ask the user which volume of scriptures they would like to learn about (for example, Old Testament, New Testament, Book of Mormon, Doctrine and Covenants, Pearl of Great Price). Then, find the book in that volume of scripture that has the largest number of chapters.
Sample Solution
When your program is finished, please view the sample solution for this program to compare it to your approach.
You should work to complete this team activity for the one hour period first, without looking at the sample solution. However, if you have worked on it for at least an hour and are still having problems, you may feel free to use the sample solution to help you finish your program.
Sample solution (Core requirements): teach12_sample.py
Sample solution (Stretch challenges): teach12_stretch_sample.py
Submission
When complete, please report your progress in the associated I-Learn quiz.
If you decided to do additional work on the program after your team activity, either by yourself or with others, feel free to include that additional work when you report on your progress in I-Learn.