Python 4a

📰 Medium · Python

Python Indexing Continue reading on Medium »

Published 17 Apr 2026

Full Article

Title: Python 4a

URL Source: https://medium.com/@Commoness/python-4a-6dd7850f9df1?source=rss------python-5

Published Time: 2026-04-17T18:11:01Z

Markdown Content:
# Python 4a. Python Indexing | by The Commoness | Apr, 2026 | Medium

[Sitemap](https://medium.com/sitemap/sitemap.xml)

[Open in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3DmobileNavBar&source=post_page---top_nav_layout_nav-----------------------------------------)

Sign up

[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40Commoness%2Fpython-4a-6dd7850f9df1&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

[](https://medium.com/?source=post_page---top_nav_layout_nav-----------------------------------------)

Get app

[Write](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fnew-story&source=---top_nav_layout_nav-----------------------new_post_topnav------------------)

[Search](https://medium.com/search?source=post_page---top_nav_layout_nav-----------------------------------------)

Sign up

[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40Commoness%2Fpython-4a-6dd7850f9df1&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

![Image 1: The Commoness](https://miro.medium.com/v2/resize:fill:64:64/1*dmbNkD5D-u45r44go_cf0g.png)

[Mastodon](https://me.dm/@Commoness)

# Python 4a

[![Image 2: The Commoness](https://miro.medium.com/v2/resize:fill:64:64/1*dmbNkD5D-u45r44go_cf0g.png)](https://medium.com/@Commoness?source=post_page---byline--6dd7850f9df1---------------------------------------)

[The Commoness](https://medium.com/@Commoness?source=post_page---byline--6dd7850f9df1---------------------------------------)

3 min read

·

Just now

[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fvote%2Fp%2F6dd7850f9df1&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40Commoness%2Fpython-4a-6dd7850f9df1&user=The+Commoness&userId=07b247769d98&source=---header_actions--6dd7850f9df1---------------------clap_footer------------------)

--

[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fbookmark%2Fp%2F6dd7850f9df1&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40Commoness%2Fpython-4a-6dd7850f9df1&source=---header_actions--6dd7850f9df1---------------------bookmark_footer------------------)

[Listen](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2Fplans%3Fdimension%3Dpost_audio_button%26postId%3D6dd7850f9df1&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40Commoness%2Fpython-4a-6dd7850f9df1&source=---header_actions--6dd7850f9df1---------------------post_audio_button------------------)

Share

## Python Indexing

## Imagine This

You have a **school bag with items arranged in order**:

bag = ["Book", "Pen", "Pencil", "Eraser", "Scale"]
Each item has a **position number** (index)

Step 1: Normal Indexing (Left → Right)

![Image 3](https://medium.com/@Commoness/python-4a-6dd7850f9df1?source=rss------python-5)

print(bag[0]) # Book

print(bag[2]) # Pencil
Python always starts counting from **0 (not 1)**

## Step 2: Negative Indexing (Right → Left)

Now imagine taking items from the **end of the bag**

![Image 4](https://medium.com/@Commoness/python-4a-6dd7850f9df1?source=rss------python-5)

REVERSE INDEXING

print(bag[-1]) # Scale

print(bag[-3]) # Pencil
## **Slicing**

Slicing means:

**“Give me some items from the list”**

list[start : stop : step]

![Image 5](https://medium.com/@Commoness/python-4a-6dd7850f9df1?source=rss------python-5)

example 1:

bag = ["pen","pencil","eraser"]

print(bag[1:4]) # 1 is to begin so index of one is pen

#index of 4 is pos-1 (4-1 =3) so it is eraser

#Start is INCLUDED

Stop is EXCLUDED

Think like:

“Start eating from here, but STOP before this”
## What if you leave spaces?

## Case 1: `[:stop]`

print(bag[:3])
Mean
Read full article → ← Back to Reads