Skip to content

Commit

Permalink
Merge pull request #151 from yashasvimisra2798/patch1
Browse files Browse the repository at this point in the history
Add heart-shaped-pattern #138
  • Loading branch information
keshavsingh4522 authored Oct 3, 2021
2 parents fdc91b9 + b9b14d4 commit 1db5583
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions GeeksForGeeks/issue/heart-shaped-pattern.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
n = 8

m = n+1

for i in range(n//2-1):
for j in range(m):

if i == n//2-2 and (j == 0 or j == m-1):
print("*", end=" ")


elif j <= m//2 and ((i+j == n//2-3 and j <= m//4) \
or (j-i == m//2-n//2+3 and j > m//4)):
print("*", end=" ")


elif j > m//2 and ((i+j == n//2-3+m//2 and j < 3*m//4) \
or (j-i == m//2-n//2+3+m//2 and j >= 3*m//4)):
print("*", end=" ")


else:
print(" ", end=" ")
print()

for i in range(n//2-1, n):
for j in range(m):


if (i-j == n//2-1) or (i+j == n-1+m//2):
print('*', end=" ")

else:
print(' ', end=" ")

print()

0 comments on commit 1db5583

Please sign in to comment.