-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChapterVerse.py
More file actions
19 lines (18 loc) · 932 Bytes
/
Copy pathChapterVerse.py
File metadata and controls
19 lines (18 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'''
DO NOT DELETE!
ChapterVerse.py is responsible for an entire feature
of the BibleApp! - the book-chapter-verse navigation feature.
It is referenced by some other scripts.
'''
import list_and_str_ops as list
def get_chap(file, chap):
'''Use this function to get a chapter of the Bible as a list\nwith each verse as one list item.\n\nThis function takes two parameters.\nOne is the file name of the book\nof the Bible you want.\nThe other is the chapter number.'''
opened_file = open(file,"r")
verses = opened_file.readlines()
chapters = [verse for verse in verses if verse.split(":")[0] == f"{chap}"]
opened_file.close()
return chapters
def get_verse(book,chap,ver):
'''Use this function to get a single \nverse of the Bible.\n\nIt takes three parameters.\nFirst, the book of the Bible.\nThe second is the chapter number.\nThe third is the verse number.'''
chapter = get_chap(book,chap)
return chapter[ver - 1]