# Python | Constant Matrix

Python | Constant Matrix: In this tutorial, we are going to learn about the constant matrix and its Python implementation.
Submitted by Anuj Singh, on July 09, 2020

In this article, we are going to create a constant matrix, where all the elements of the matrix have the same constant value. This can be done by online inbuilt function numpy.full(). This NumPy library function returns a constant matrix.

## Python code to create constant matrix

```# Linear Algebra Learning Sequence
# Constant Matrix

import numpy as np

M = np.full((5,6), 44)

print('A constant matrix with all entries as 44 :\n', M)
```

Output:

```A constant matrix with all entries as 44 :
[[44 44 44 44 44 44]
[44 44 44 44 44 44]
[44 44 44 44 44 44]
[44 44 44 44 44 44]
[44 44 44 44 44 44]]
```

Preparation

What's New

Top Interview Coding Problems/Challenges!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates