Sitemap
İclal Şeyma Koca

İclal Şeyma Koca

Mechanical Engineer

Python Data Structures: List

2 min readNov 3, 2022

Hello, I am Şeyma, one of the participants of the SistersLab Women in Tech Academy project supported by Toplum Gonulluleri Vakfı (https://www.tog.org.tr/en/).

The project aims to empower people between the age of 20–28 who identify as women, through 3 months long software training and supporting training to increase their participation in the workforce in the IT sector.

You can access detailed information about the project using this link: https://sisterslab.co/women-in-tech-academy/

I will share with you what I learned about python as part of this beautiful project. I wish you good reading.

Python List Structure

Lists, sets of comma-separated values ​​(items) between square brackets, are the most useful data type available in Python. The important thing about a list is that the items in a list don’t have to be of the same type.

Creating a list is clustering different values ​​separated by commas between square brackets.

  • Accessing Values ​​in Lists

You can also use index numbers in square brackets for assignment operations to access values ​​in lists.

  • List Functions and Methods

Python List Functions

  • len(list)

Returns the total length of the list.

  • max(list)

Returns the highest value item from the list.

  • min(list)

Returns the lowest value item from the list.

  • list(seq)

Returns a tuple list

Get İclal Şeyma Koca’s stories in your inbox

Join Medium for free to get updates from this writer.

Python List Methods

  • list.append(obj)

Adds the object to the list.

  • list.count(obj)

Returns the number of objects in the list

  • list.extend(seq)

Adds the directory contents to the list

  • list.index(obj)

Returns the lowest index number where the Object appears in the list.

  • list.insert(obj)

Inserts the Object after the specified offset array.

  • list.pop(obj=list)

Removes and returns the last object or item in the list

  • list.remove(obj)

Removes the item from the list.

  • list.reverse()

Reverses the list.

  • list.sort([func])

Sorts the list.

Press enter or click to view image in full size

--

--