Syntax

Python Create a List Syntax

In Python, create a list: creates an ordered, changeable list — nums = [1, 2, 3]

Quick Answer

Syntax
nums = [1, 2, 3]
PythonSyntax

Create a List

Code example
nums = [1, 2, 3]

Creates an ordered, changeable list.

Learn More

How to create a list in Python

  1. Open your Python file or editor.
  2. Copy the example, then replace its sample names and values for your code.

Python Create a List Syntax

Use nums = [1, 2, 3].

Related Syntax References

Frequently asked questions

What is the Python syntax for create a list?

Use this pattern: nums = [1, 2, 3]

Can I copy this Python code example?

Yes. Use Copy code and adapt the example to your program.

Is this Python syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify