Create Plus (+) Shape Using NumPy Array | Python NumPy Pattern Program
Автор: Trendroid
Загружено: 2026-01-12
Просмотров: 3
In this video, you will learn how to create a plus (+) shape using NumPy in Python.
Given a positive number n greater than 2, we create a NumPy array of size n × n
filled with zeros and ones such that the ones form a plus (+) shape.
Example:
Input:
n = 5
Output:
0 0 1 0 0
0 0 1 0 0
1 1 1 1 1
0 0 1 0 0
0 0 1 0 0
Concepts covered in this video:
NumPy arrays
np.zeros function
2D array indexing
Middle row and column logic
Pattern creation using NumPy
This video is useful for:
Python beginners
NumPy practice
Logic building
Interview and exam preparation
Like, Share and Subscribe for more Python and NumPy videos.
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: