Skip to content

Commit

Permalink
Added New Project
Browse files Browse the repository at this point in the history
  • Loading branch information
6292santosh committed Jan 9, 2020
1 parent 8d39f8a commit 3e9a8ba
Show file tree
Hide file tree
Showing 19 changed files with 263 additions and 64 deletions.
42 changes: 21 additions & 21 deletions Project Pattern/pattern_08.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
def pattern_eight(strings):
'''Pattern eight
P
P r
P r o
P r o g
P r o g r
P r o g r a
P r o g r a m
P r o g r a m m
P r o g r a m m i
P r o g r a m m i n
P r o g r a m m i n g
P r o g r a m m i n
P r o g r a m m i
P r o g r a m m
P r o g r a m
P r o g r a
P r o g r
P r o g
P r o
P r
P
P
P r
P r o
P r o g
P r o g r
P r o g r a
P r o g r a m
P r o g r a m m
P r o g r a m m i
P r o g r a m m i n
P r o g r a m m i n g
P r o g r a m m i n
P r o g r a m m i
P r o g r a m m
P r o g r a m
P r o g r a
P r o g r
P r o g
P r o
P r
P
'''

if not str(strings).isalpha():
Expand Down
18 changes: 9 additions & 9 deletions Project Pattern/pattern_09.py
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):
Expand Down
18 changes: 9 additions & 9 deletions Project Pattern/pattern_10.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
def pattern_ten(strings):
'''Pattern ten
K
K A
K A T
K A T H
K A T H M
K A T H M A
K A T H M A N
K A T H M A N D
K A T H M A N D U
K
K A
K A T
K A T H
K A T H M
K A T H M A
K A T H M A N
K A T H M A N D
K A T H M A N D U
'''

if not str(strings).isalpha():
Expand Down
18 changes: 9 additions & 9 deletions Project Pattern/pattern_13.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
def pattern_thirteen(strings):
'''Pattern thirteen
U
D
N
A
M
H
T
A
K
U
D
N
A
M
H
T
A
K
'''

if not str(strings).isalpha():
Expand Down
16 changes: 8 additions & 8 deletions Project Pattern/pattern_14.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
def pattern_fourteen(strings):
'''Pattern fourteen
K
K
A
T
H
M
A
T
H
M
A
N
D
U
N
D
U
'''

if not str(strings).isalpha():
Expand Down
15 changes: 8 additions & 7 deletions Project Pattern/pattern_24.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
def pattern_twenty_four(string):
'''Pattern twenty_four
*****
*
*
****
*
*
*****
*****
*
*
****
*
*
*****
'''

for i in range(7):
Expand Down
1 change: 1 addition & 0 deletions Project Pattern/pattern_25.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
def pattern_twenty_five(string):
'''Pattern twenty_five
****
* *
* *
Expand Down
1 change: 1 addition & 0 deletions Project Pattern/pattern_26.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
def pattern_twenty_six(string):
'''Pattern twenty_six
***
* *
*
Expand Down
1 change: 1 addition & 0 deletions Project Pattern/pattern_27.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
def pattern_twenty_seven(string):
'''Pattern twenty_seven
*
*
*
Expand Down
1 change: 1 addition & 0 deletions Project Pattern/pattern_29.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
def pattern_twenty_nine(string):
'''Pattern twenty_nine
***
* *
* *
Expand Down
1 change: 1 addition & 0 deletions Project Pattern/pattern_30.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
def pattern_thirty(string):
'''Pattern thirty
****
* *
* *
Expand Down
2 changes: 1 addition & 1 deletion Project Pattern/pattern_32.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ def pattern_thirty_one(string, steps):


if __name__ == '__main__':
pattern_thirty_one('|||||', 20)
pattern_thirty_one('*', 20)
24 changes: 24 additions & 0 deletions Project Pattern/pattern_33.py
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()
31 changes: 31 additions & 0 deletions Project Pattern/pattern_34.py
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)
30 changes: 30 additions & 0 deletions Project Pattern/pattern_35.py
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)
27 changes: 27 additions & 0 deletions Project Pattern/pattern_36.py
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()
27 changes: 27 additions & 0 deletions Project Pattern/pattern_37.py
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()
30 changes: 30 additions & 0 deletions Project Pattern/pattern_38.py
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()
Loading

0 comments on commit 3e9a8ba

Please sign in to comment.