How to Increase Matrix Size on Python

Python uses multidimensional arrays to create a matrix of numbers. When you create an array, you specify the size of each array element for the matrix. You use the "resize" function to add elements to a matrix when you need more room for additional data. The added data is appended after the last value in the matrix.

Instructions

    • 1

      Open your Python editor and open the source code file to view the current code in the editor. Locate the array you want to resize.

    • 2

      Create a variable to add an integer value to the array. The following code sets up a variable to add 3 more values to a matrix array:

      addvalues = 3;

    • 3

      Call the "resize" function to add the additional space to the array. The following code appends three storage spaces to the array named "myarray":

      myarray.resize(addvalues)

Related Searches:

References

Comments

Related Ads

Featured