Introduction to NumPy

NumPy - Chapter 1

NumPy Tutorial

We appreciate your patience while we actively develop and enhance our content for a better experience.

Sample Code
import numpy as np

def main():
    print("This program demonstrates how to use NumPy to create and manipulate arrays.")
    print("We will calculate the sum of two matrices.")
    
    # Create two matrices of size 3x3 with random integers between 1 and 10
    matrix1 = np.random.randint(1, 11, size=(3, 3))
    matrix2 = np.random.randint(1, 11, size=(3, 3))

    # Calculate the sum of the matrices
    matrix_sum = matrix1 + matrix2

    print("Matrix 1:")
    print(matrix1)

    print("\nMatrix 2:")
    print(matrix2)

    print("\nSum of the matrices:")
    print(matrix_sum)

if __name__ == "__main__":
    main()