Coding with AI

Code Faster. Think Smarter. Ship Better—with AI.

Stop fighting boilerplate and busywork. Coding with AI shows professional Python developers how to use AI tools to accelerate design, coding, testing, debugging, and documentation—without sacrificing quality or control. Learn proven prompts, real workflows, and practical techniques you’ll use on the job every day.

Explore the book ->


Creating an Empty List in Python

A list is a collection of items in a particular order. You can create empty lists in Python using the square brackets notation, but there’s no need for any elements inside them as they are by default …

Updated November 23, 2023

A list is a collection of items in a particular order. You can create empty lists in Python using the square brackets notation, but there’s no need for any elements inside them as they are by default empty (empty).

Creating an empty list in Python is easy and it’s done just like this: my_list = []

Once you have an empty list, you can add items to the list using various methods. For example, if you want to append a new item to the end of your list:

my_list.append(item)

If you know how many elements you’re going to need in advance, you can initialize the list with that number of items:

my_list = [None]*n

Or if you want a new list with certain values:

my_list = ["item1", "item2", ...] # up to however many items you need.

These are just some examples of how to create empty lists in Python. You can use the methods and syntax as needed to achieve your goals.

Coding with AI

AI Is Changing Software Development. This Is How Pros Use It.

Written for working developers, Coding with AI goes beyond hype to show how AI fits into real production workflows. Learn how to integrate AI into Python projects, avoid hallucinations, refactor safely, generate tests and docs, and reclaim hours of development time—using techniques tested in real-world projects.

Explore the book ->