How to create an array in python

Example Example Python can use the built-in list data type to create an array. A list is an ordered, mutable container that allows the storage of different types of data. Code example:

Python can create an array using the built-in list data type. A list is an ordered, mutable container that allows the storage of different types of data.

Code example:

#Create an empty array

arr = []

#Add elements to the array

arr.append(1)

arr.append(2)

arr.append(3)

# Print out the array

print(arr)

# Output result: [1, 2, 3]

Guess you like

Origin blog.csdn.net/weixin_44591885/article/details/133385327