To use a GPIO port, you must first configure the port for input or output. When configured for output, a GPIO port can be set to a HIGH (+3.3 V) or LOW (0 V) condition by your programs. When configured for input, a program can easily determine the current state (HIGH or LOW).
The figure lists the function of each pin on the Raspberry Pi 2 and 3 40-pin header block.
Unfortunately, the pins on the header block are not labeled in any way on the Raspberry Pi board. If you orient the board so that the header block is on the right edge of the board, just above the USB ports, pins 1 and 2 are at the top of the header block. The odd numbered pins are on the left side of the header block; even numbered pins are on the right side.
You've probably already noticed that the pins on the header block don't appear to be laid out in any particular logical order. The GPIO ports are scattered about the header haphazardly, interspersed with 3.3 V, 5 V, and Ground pins at seemingly random locations.
To avoid confusion when programming Raspberry Pi projects, people common number the GPIO ports using their header pin numbers rather than the GPIO port numbers. For example, GPIO port 19 can be referred to as pin 10 in a Python program. When you write your programs in this way, you can completely ignore the GPIO port number, instead referring to the GPIO port using its pin number. The only trick when you do this is to remember that not all the pins on the 40-pin header are used for GPIO ports; only those pin numbers designated as GPIO ports in the figure should be used as GPIO ports.
The GPIO ports on a Raspberry Pi are rated for about 16 mA of current flow each, with a total of 40 mA across all GPIO ports combined. When designing circuits that interface with the GPIO ports, keep this limit in mind. Make sure you provide adequate current-limiting resistors to avoid damaging your Pi.