This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#to check wheather the given parenthesis are valid or not implementation is done using stack | |
pat = '[({()})[]}' | |
lst = [] | |
srt_pat = ['{', '(', '['] | |
cls_pat = ['}', ')', ']'] | |
chec_lst=['{}','()','[]'] | |
for i in range(len(pat)): | |
if (pat[i] in srt_pat): | |
lst.append(pat[i]) | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = [[1, 2, 3, 4, 5, 6], | |
[7, 8, 9, 10, 11, 12], | |
[13, 14, 15, 16, 17, 18]] | |
int_row = 0 | |
last_row = 3 | |
int_col = 0 | |
last_col = 6 | |
while(int_row<=last_row and int_col<=last_col): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = [[1, 2, 3, 4, 5, 6], | |
[7, 8, 9, 10, 11, 12], | |
[13, 14, 15, 16, 17, 18]] | |
int_row = 0 | |
last_row = 3 | |
int_col = 0 | |
last_col = 6 | |
while(int_row<=last_row and int_col<=last_col): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enter the height=3 | |
enter the width=3 | |
enter the number of stairs=3 | |
@@@ @@@ | |
@@ @@ | |
@ @ | |
@@@ @@@ | |
@@ @@ | |
@ @ | |
@@@ @@@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enter the height=3 | |
enter the width=3 | |
enter the number of stairs=3 | |
@@@ | |
@@ | |
@ | |
@@@ | |
@@ | |
@ | |
@@@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pattern runs for both odd and even number starting from n==3 | |
n==3 | |
* * * * * | |
* * * | |
* * * * | |
* * * * * | |
n==4 | |
* * * * * * | |
* * * | |
* * * * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pattern run for only off number like ->3,5,7,9,11 etc | |
#n==3 | |
*********** | |
* | * | |
* * * | |
*---***---* | |
#for n==5 | |
***************** | |
* | * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#for n==9 | |
* * * | |
* *** * | |
* ***** * | |
* ******* * | |
*---------*********---------* | |
* ******* * | |
* ***** * | |
* *** * | |
* * * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#only runs for 1,3 and 5 | |
#pattern is | |
#n==5 | |
1 | |
232 | |
34543 | |
4567654 | |
567898765 | |
#for n==3 | |
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#webkul pattern program round 1 | |
#pattern runs for odd number like min 3 , 5, 7 etc | |
#here is ther pattern | |
#for n==3 | |
* * | |
** ** | |
***@@@*** | |
@@@ | |
@@@ | |
*** |