Skip to content

Commit 74e63f3

Browse files
Merge pull request #2291 from 16ratneshkumar/patch-1
Optimize solution
2 parents eb288ee + 15bbe55 commit 74e63f3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Patterns/pattern5.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ def main():
99
lines = int(input("Enter the number of lines: "))
1010
pattern(lines)
1111

12-
def pattern(rows):
13-
for i in range(1, rows+1):
14-
for j in range(i, 0, -1):
15-
print(j, end="")
16-
print()
12+
def pattern(rows):
13+
const=''
14+
for i in range(1, rows+1):
15+
const=str(i)+const
16+
print(const)
1717

1818
if __name__ == "__main__":
1919
main()

0 commit comments

Comments
 (0)