# Python: Zero Order Indexing

## Counting: 1st Order Indexing

As humans we often live in the decimal system, this is because we have ten fingers and ten number characters.

It has been a common convention to count using First order indexing. By this convention our first finger is 1, our second finger is 2, our third finger is 3, our 4th finger is 4, our 5th finger is 5, our 6th finger is 6, our 7th finger is 7, our 8th finger is 8, our 9th finger is 9 and our tenth finger is 10…

With this method of counting the obvious problem is that we do not map all 10 numerical digits [0,1,2,3,4,5,6,7,8,9] to our 10 fingers. This is resolved with Zero Order Indexing.

## Counting: 0th Order Indexing

In this convention our zeroth finger is 0, our 1st finger is 1, our 2nd finger is 2, our third finger is 3, our 4th finger is 4, our 5th finger is 5, our 6th finger is 6, our 7th finger is 7, our 8th finger is 8 and our 9th finger is 9. Python uses, this convention so take a moment to learn how to count again and it will help you greatly when using Python.

Note when we count to 10 using 0th order indexing, we could up to the value 10 but don’t include it. This aligns with our decimal notation:

[0,1,2,3,4,5,6,7,8,9]

Where each number up to 10 including 0 is represented by a single digit.

If we only look at one of our hands, we count up to but not including 5. This gives us:

[0,1,2,3,4]

## Advantage of Zero Order Indexing

The main advantage of Zeroth order indexing is that difference between a value and the starting value is equal to that value opposed to the value minus 1. Likewise addition of the stating point to a value is equal to the value opposed to the value minus 1.

Difference from Start Point (1st Order Indexing)Difference from Start Point (0th Order Indexing)Addition of Start Point (1st Order Indexing)Addition from Start Point (0th Order Indexing)
1-1=00-0=00+1=10+0=0
2-1=01-0=11+1=21+0=1
3-1=22-0=21+2=32+0=2
4-1=33-0=31+3=43+0=3
5-1=34-0=41+4=54+0=4
6-1=55-0=51+5=65+0=5
7-1=66-0=61+6=76+0=6
8-1=77-0=71+7=87+0=7
9-1=88-0=81+8=98+0=8
9-0=09+0=9