Python Tutorial - Counting Beers

in #python6 years ago


You’re 4 beers into studying. And because you like crappy beers, you write down the following beer you drank on your list:


For more NSFW Python 3 tutorials, visit Redheadedpython.com

If any of these beer companies want sponsor my website, I’ll happily remove your shitty beer and put up some other shitty competitor’s beer

Let’s say you want to print out the fourth element (“Miller Lite”) in this list. You’d probably type:

That would result in “Index error: Out of Range”. What kind of communist shithole decided how to count in programming? Here is something that confuses the fuck out of every new, young, sassy man or gentlewoman. Programmers don’t start counting at 1. They start counting at fucking 0. Zero. One less than one. How do we get Miller Lite from that list again?

Welcome to the bane of your existence and source of half of your debugging errors until you get this crap hammered into your noggin. Let me make this real easy:

Programmers measure their sobriety not by counting the first beer, but by counting when they were sober and hadn’t touched beer yet. Remember this, and I hope you’re one more beer deeper than when you started reading this. If not, fix it.

Sort:  

Haha this is something to explain to the officer that pulls you over after a couple!

Breathalyzers need to be adjusted accordingly