Python’s range function produces integers from a starting value up to, but not including, an ending value. Thus, range(0, 9) produces 0 through 8; use range(0, 10) to include 9. section 1.1.1 section 5.1.1
Wrap range in list to see its values directly. In a loop, combine range with len to visit each valid index of a list or string. section 5.1.1 section 5.1.1
Loop through a list by index
lst = ['cat', 'dog', 'bird', 'fish'] for index in range(0, len(lst)): print('Got', lst[index]) print('Hello,', lst[index]) The indices are 0, 1, 2, and 3, matching the four valid positions in lst. The loop stops before len(lst), which is 4. section 5.1.1







