python3 array (list) initialization
1. Initialize a fixed-length array
Sometimes it is necessary to predefine a fixed-length array and assign a value to each element
Method 1: The code in python3 is as follows:
1 2 3 4 |
|
result:
1 |
|
Method 2: The code in python3 is as follows:
1 2 3 |
|
result:
1 |
|
2. Initially create an array of n rows and m columns
1 2 3 4 5 6 7 |
|
result:
1 |
|