Skip to content

Commit

Permalink
Merge pull request #2291 from 16ratneshkumar/patch-1
Browse files Browse the repository at this point in the history
Optimize solution
  • Loading branch information
geekcomputers committed Aug 13, 2024
2 parents eb288ee + 15bbe55 commit 74e63f3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Patterns/pattern5.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ def main():
lines = int(input("Enter the number of lines: "))
pattern(lines)

def pattern(rows):
for i in range(1, rows+1):
for j in range(i, 0, -1):
print(j, end="")
print()
def pattern(rows):
const=''
for i in range(1, rows+1):
const=str(i)+const
print(const)

if __name__ == "__main__":
main()

0 comments on commit 74e63f3

Please sign in to comment.