Skip to content

Commit

Permalink
Merge pull request #2293 from 16ratneshkumar/patch-3
Browse files Browse the repository at this point in the history
Optimize solution
  • Loading branch information
geekcomputers authored Aug 13, 2024
2 parents c5dab9e + cb12a3d commit b07ccba
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions Patterns/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,11 @@ def main():
pattern(lines)

def pattern(lines):
for i in range(1,lines+1):
print("* "*i)
print()
for i in range(lines):
for j in range(i+1):
print("* ", end="")
print("")
print(" ")

for i in range(0,lines):

for j in range(0, (2 * (i - 1)) + 1):
print(" ", end="")

for j in range(0, lines - i):
print("*", end=" ")

print("")
print(" "*i,"* "*(lines-i))

if __name__ == "__main__":
main()

0 comments on commit b07ccba

Please sign in to comment.