Everyone who uses Python knows that the range() function is very convenient. When I used it again today, I discovered a lot of details that I had seen before but had forgotten. Here we record range(), review the list slide, and finally analyze a fun bubbling program.
Record it here:
>>> range(1,5) #Represents from 1 to 5 (excluding 5)
[1, 2, 3, 4]
>>> range(1,5,2) #Represents from 1 to 5, interval 2 (not including 5)
[1, 3]
>>> range(5) #Represents from 0 to 5 (not including 5)
[0, 1, 2, 3, 4]