Create a List of Zeros in Python

  • Post category:List

Creating a list of zeros in Python can be done using the * operator or list comprehension. Here are two examples:

Example 1:

Python

Output:

List of zeros: [0, 0, 0, 0, 0]

Example 2:

Python

Output:

List of zeros: [0, 0, 0]