filmov
tv
Concentric square pattern in Python with explanation part 2 || #ProgrammingKnowledge

Показать описание
#concentric #square #python
Hello friends!!
Welcome to our you tube channel "Programming Knowledge".
In this video, I have described the logic and the program of concentric square pattern in Python.
What is concentric square pattern:
Concentric square pattern is a rectangular pattern in a 2D matrix in such a way that they are concentric to each other.
4 4 4 4 4 4 4
4 3 3 3 3 3 4
4 3 2 2 2 3 4
4 3 2 1 2 3 4
4 3 2 2 2 3 4
4 3 3 3 3 3 4
4 4 4 4 4 4 4
There are so many methods for printing this pattern.
In this video, I found minimum value form the index i, j, size-1-i, size-1-j.
Here is the code with list comprehension:
[print(''.join(str(n-min(i,j,high-i-1,high-j-1)) for i in range(high))) for j in range(high)]
If you know another method to print this pattern then comment below.
***************************************************************************************
SUBSCRIBE TO PROGRAMMING KNOWLEDGE:
***************************************************************************************
***************************************************************************************
BLOGPOST LINK:
***************************************************************************************
Here is the link of Spiral matrix in C language
If you like to make matrix effect in c which is shown in intro of this video then watch this video.
I hope you got the logic and the program, if you have any other doubts then feel free to ask in comment section.
Also, there are lots of other techniques to print this patter.
If you want other methods to print this pattern then comment below.
I will make second part of this video.
And don't forget to like this video.
Also, share this video with your friends.
If you are new to this channel then hit the subscribe button and don't forget to click on the bell icon.
We will meet in the next video, until then enjoy programming.
JAY HIND.
Hello friends!!
Welcome to our you tube channel "Programming Knowledge".
In this video, I have described the logic and the program of concentric square pattern in Python.
What is concentric square pattern:
Concentric square pattern is a rectangular pattern in a 2D matrix in such a way that they are concentric to each other.
4 4 4 4 4 4 4
4 3 3 3 3 3 4
4 3 2 2 2 3 4
4 3 2 1 2 3 4
4 3 2 2 2 3 4
4 3 3 3 3 3 4
4 4 4 4 4 4 4
There are so many methods for printing this pattern.
In this video, I found minimum value form the index i, j, size-1-i, size-1-j.
Here is the code with list comprehension:
[print(''.join(str(n-min(i,j,high-i-1,high-j-1)) for i in range(high))) for j in range(high)]
If you know another method to print this pattern then comment below.
***************************************************************************************
SUBSCRIBE TO PROGRAMMING KNOWLEDGE:
***************************************************************************************
***************************************************************************************
BLOGPOST LINK:
***************************************************************************************
Here is the link of Spiral matrix in C language
If you like to make matrix effect in c which is shown in intro of this video then watch this video.
I hope you got the logic and the program, if you have any other doubts then feel free to ask in comment section.
Also, there are lots of other techniques to print this patter.
If you want other methods to print this pattern then comment below.
I will make second part of this video.
And don't forget to like this video.
Also, share this video with your friends.
If you are new to this channel then hit the subscribe button and don't forget to click on the bell icon.
We will meet in the next video, until then enjoy programming.
JAY HIND.
Комментарии