Ordinal data represents an item's position in an ordered sequence: 1 becomes first, 2 becomes second, and 3 becomes third. In Python, a list or dictionary can map numeric positions to ordinal strings. section 13.1.2 section 13.3.1
Lists use zero-based indexes, so a one-based day requires ordinal[day - 1]. A dictionary keyed by day numbers avoids that adjustment; either representation can support a reusable verse(day) function. section 13.3.1 section 13.3.1
Mapping days to ordinal strings
ordinal = ['first', 'second', 'third'] ordinal[3 - 1] # 'third' The same lookup can use {1: 'first', 2: 'second', 3: 'third'}. Tests can verify that verse(1) and verse(2) produce the expected opening lines. section 13.3.1 section 13.1.2
Do not confuse ordinal position with Python's ord(): ord() returns a character's numeric value in the ASCII table, while chr() converts that value back to a character. section 18.1.2
>>> day = 3 >>> ordinal[day - 1] 'third'
Inspect the one-based day to zero-based list-index conversion that retrieves 'third'. section 13.3.1







