---
title: "How to Create List in Python Best Example"
description: "Python List commands useful to work with arrays and data."
url: https://srinimf.com/2018/02/28/python-real-list-commands/
date: 2018-02-28
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2018/02/python-list-commands.jpg?fit=1200%2C900&ssl=1
categories: ["Python"]
tags: ["Python list commands", "Python tips and tricks"]
type: post
lang: en
---

# How to Create List in Python Best Example

In Python, the manipulating list also called arrays, is the main task while you are dealing or working with data. Stanford University in its Python tutorial added the below [best examples](https://srinimf.com/2020/04/28/evaluate-also-example/).

Related[Append() vs Extend(): A Detailed Comparison for Python Lists](https://srinimf.com/2024/09/12/append-vs-extend-a-detailed-comparison-for-python-lists/)

---

Pyth[on List](https://srinimf.com/2023/03/27/python-how-to-filter-list-best-example/) Commands

I am giving here for your reference. The hash given below is just a comment. It is not command.

## Useful Commands to Create a List

Create a new list

```
empty = []
letters = [‘a’, ‘b’, ‘c’, ‘d’]
numbers = [2, 3, 5]
```

Lists can contain elements of different types

```
mixed = [4, 5, “seconds”]
```

Append elements to the end of a list

```
numbers.append(7)
numbers == [2, 3, 5, 7]
numbers == [2, 3, 5, 7]
numbers.append(11)
numbers == [2, 3, 5, 7, 11]
```

Access elements at a particular index

```
numbers[0] # => 2
numbers[-1] # => 11
```

Slice Lists rules to apply

```
letters[:3] # => ['a', 'b', 'c']
numbers[1:-1] # => [3, 5, 7]
```

Other Lists

```
x = [letters, numbers]
x # => [['a', 'b', 'c', 'd'], [2, 3, 5, 7, 11]]
x[0] # => ['a', 'b', 'c', 'd']
x[0][1] # => 'b'
x[1][2:] # => [5, 7, 11]
```

**[How to](https://srinimf.com/2021/01/02/python-arrays-vs-lists-best-examples/) Create [List in Python](https://srinimf.com/2022/03/27/how-to-print-n-numbers-in-a-list-in-python/) a Video**

Related Posts

- [How to Understand List and Arrays in Python](https://srinimf.com/2021/01/02/python-arrays-vs-lists-best-examples/)DateJanuary 2, 2021
- [How to Get Array Dimension in Python [NumPy]](https://srinimf.com/2022/10/29/how-to-know-array-dimension-in-python-numpy/)DateOctober 29, 2022
- [6 Top Python Data Types: How to Understand Now](https://srinimf.com/2022/12/19/how-to-understand-data-types-in-python-quickly/)DateDecember 19, 2022

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2018%2F02%2F28%2Fpython-real-list-commands%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2018%2F02%2Fpython-list-commands.jpg%3Ffit%3D1200%252C900%26ssl%3D1&description=How%20to%20Create%20List%20in%20Python%20Best%20Example)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2018/02/28/python-real-list-commands/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2018/02/28/python-real-list-commands/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2018/02/28/python-real-list-commands/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2018/02/28/python-real-list-commands/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20How%20to%20Create%20List%20in%20Python%20Best%20Example&body=https%3A%2F%2Fsrinimf.com%2F2018%2F02%2F28%2Fpython-real-list-commands%2F&share=email)
-

### Like this:

Like Loading…
