Member-only story

Day 6 of #100DaysOfCode in Python: Unpacking the Power of Lists

Elshad Karimov
3 min readSep 25, 2023

Welcome to Day 6 of your #100DaysOfCode journey in Python! If you’ve made it this far, you’re well on your way to becoming proficient in Python programming. Today, we’re going to focus on an essential aspect of Python and indeed most programming languages: data structures, particularly lists. Lists are a cornerstone of Python and are widely used for a variety of tasks. By the end of this article, you’ll understand how to manipulate, access, and modify elements within lists effectively.

What are Lists?

In Python, a list is a data structure that holds an ordered collection of items. These items can be of any data type, and a list can even contain other lists. Lists are defined by enclosing the items in square brackets [ ], separated by commas.

# A simple list
my_list = [1, 2, 3, 4, 5]

# A list with mixed data types
mixed_list = [1, 'Python', 3.14, [1, 2, 3]]

Why Use Lists?

  1. Ordered Collection: Lists maintain the order of the elements.
  2. Mutable: Unlike some other data structures like tuples, lists are mutable, which means you can modify their contents.
  3. Versatile: Lists can store items of different data types, including other lists.

--

--

Elshad Karimov
Elshad Karimov

Written by Elshad Karimov

Software Engineer, Udemy Instructor and Book Author, Founder at AppMillers

No responses yet