forked from ghanteyyy/nppy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
6292santosh
committed
Jan 9, 2020
1 parent
8d39f8a
commit 3e9a8ba
Showing
19 changed files
with
263 additions
and
64 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
def pattern_nine(strings): | ||
'''Pattern nine | ||
K | ||
A | ||
T | ||
H | ||
M | ||
A | ||
N | ||
D | ||
U | ||
K | ||
A | ||
T | ||
H | ||
M | ||
A | ||
N | ||
D | ||
U | ||
''' | ||
|
||
def method_one(strings): | ||
|
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
def pattern_twenty_five(string): | ||
'''Pattern twenty_five | ||
**** | ||
* * | ||
* * | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
def pattern_twenty_six(string): | ||
'''Pattern twenty_six | ||
*** | ||
* * | ||
* | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
def pattern_twenty_seven(string): | ||
'''Pattern twenty_seven | ||
* | ||
* | ||
* | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
def pattern_twenty_nine(string): | ||
'''Pattern twenty_nine | ||
*** | ||
* * | ||
* * | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
def pattern_thirty(string): | ||
'''Pattern thirty | ||
**** | ||
* * | ||
* * | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
def pattern_thirty_three(): | ||
'''Pattern thirty_three | ||
1 1 | ||
12 21 | ||
123 321 | ||
1234 4321 | ||
123454321 | ||
''' | ||
|
||
num = '12345' | ||
|
||
for i in range(5): | ||
slice = num[0: i + 1] | ||
|
||
if i < 4: | ||
print(f'{slice.ljust(8 - i)}{slice[::-1]}') | ||
|
||
else: | ||
print(f'{slice.ljust(8 - i)}{slice[:-1][::-1]}') | ||
|
||
|
||
if __name__ == '__main__': | ||
pattern_thirty_three() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
def pattern_thirty_four(strings, steps): | ||
'''Pattern thirty_four | ||
* | ||
* * | ||
* * * | ||
* * * * | ||
* * * * * | ||
* * * * * * | ||
* * * * * * | ||
* * * * * * | ||
* * * * * | ||
* * * * | ||
* * * | ||
* * | ||
* | ||
''' | ||
|
||
for i in range(1, steps + 1): | ||
multiplying_strings = strings * i # Multiplying the given string with 'i' to get the same character | ||
joining_strings = ' '.join(multiplying_strings).center(steps * 4) # Joining the multiplied character 'a' with spaces and placing them to the center | ||
print(joining_strings.rstrip()) # Stripping spaces of right side | ||
|
||
for i in range(steps + 1, 0, -1): | ||
multiplying_strings = strings * i # Multiplying the given string with 'i' to get the same character | ||
joining_strings = ' '.join(multiplying_strings).center(steps * 4) # Joining the multiplied character 'a' with spaces and placing them to the center | ||
print(joining_strings.rstrip()) # Stripping spaces of right side | ||
|
||
|
||
if __name__ == '__main__': | ||
pattern_thirty_four('*', 6) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
def pattern_thirty_five(strings, steps): | ||
'''Pattern thirty_five | ||
* * * * * * | ||
* * * * * | ||
* * * * | ||
* * * | ||
* * | ||
* | ||
* | ||
* * | ||
* * * | ||
* * * * | ||
* * * * * | ||
* * * * * * | ||
''' | ||
|
||
for i in range(steps, 0, -1): | ||
multiplying_strings = strings * i # Multiplying the given string with 'i' to get the same character | ||
joining_strings = ' '.join(multiplying_strings).center(steps * 4) # Joining the multiplied character 'a' with spaces and placing them to the center | ||
print(joining_strings.rstrip()) # Stripping spaces of right side | ||
|
||
for i in range(1, steps + 1): | ||
multiplying_strings = strings * i # Multiplying the given string with 'i' to get the same character | ||
joining_strings = ' '.join(multiplying_strings).center(steps * 4) # Joining the multiplied character 'a' with spaces and placing them to the center | ||
print(joining_strings.rstrip()) # Stripping spaces of right side | ||
|
||
|
||
if __name__ == '__main__': | ||
pattern_thirty_five('*', 6) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
def pattern_thirty_six(): | ||
'''Pattern thirty_six | ||
1 | ||
1 2 | ||
1 3 | ||
1 4 | ||
1 2 3 4 5 | ||
''' | ||
num = '12345' | ||
|
||
for i in range(1, 6): | ||
x = num[:i] | ||
|
||
if i in range(2, 5): | ||
space = 2 * (i - 1) - i # using 2*n - 1 for getting required space where n = 1, 2, 3, .... and here n = i - 1 | ||
print(x[0] + ' ' * space + x[-1]) | ||
|
||
elif i == 5: | ||
print(' '.join(num)) | ||
|
||
else: | ||
print(x) | ||
|
||
|
||
if __name__ == '__main__': | ||
pattern_thirty_six() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
def pattern_thirty_seven(): | ||
'''Pattern thirty_seven | ||
1 2 3 4 5 | ||
2 5 | ||
3 5 | ||
4 5 | ||
5 | ||
''' | ||
|
||
num = '12345' | ||
|
||
for i in range(1, 6): | ||
if i == 1: | ||
print(' '.join(num)) | ||
|
||
elif i in range(2, 5): | ||
space = -2 * i + 9 # using -2*n + 9 for getting required space where n = 1, 2, 3, .... and here n = i | ||
output = num[i - 1] + ' ' * space + '5' | ||
print(output) | ||
|
||
else: | ||
print('5') | ||
|
||
|
||
if __name__ == '__main__': | ||
pattern_thirty_seven() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
def pattern_thirty_eight(): | ||
'''Pattern thirty_eight | ||
1 | ||
1 2 | ||
1 3 | ||
1 4 | ||
1 2 3 4 5 | ||
''' | ||
|
||
num = '12345' | ||
|
||
for i in range(5): | ||
if i in range(1, 4): | ||
space = ' ' * (2 * i - 1) | ||
temp = num[:i + 1] | ||
|
||
output = space.join(temp[0] + temp[-1]) | ||
print(output.center(30)) | ||
|
||
elif i == 4: | ||
output = ' '.join(num) | ||
print(output.center(30)) | ||
|
||
else: | ||
print('1'.center(30)) | ||
|
||
|
||
if __name__ == '__main__': | ||
pattern_thirty_eight() |
Oops, something went wrong.