S is for slicing - Python A to Z 0 ▲ Juha-Matti Santala 43 minutes ago · Gaming · hide · 0 comments Python A-Z is a blog series about Python. Each day, I share insights, ideas and examples for different parts of Python development that match with the letter of the day. Blaugust is an annual blogging festival in August where the goal is to write a blog post every day of the month. Another 101 level primer day! Today, I write about slicing lists. Python has a very nice syntax for it, albeit one that can take a bit to get comfortable with. Let’s start with index access To access a single item in a list, you use [i] where i is the index: pokemon = ['Pikachu', 'Snorlax', 'Bulbasaur'] print(pokemon[0]) # Pikachu print(pokemon[1]) # Snorlax print(pokemon[2]) # Bulbasaur If you’re new to programming, it’s important to note that the indexing starts at 0, not 1. This is common for a lot of programming languages but not universal. If you try to access an index that is larger than the last available index, you’ll run into an IndexError : pokemon = ['Pikachu', 'Snorlax', 'Bulbasaur']… No comments yet. Log in to reply on the Fediverse. Comments will appear here.