Skip to content

Commit 15bbe55

Browse files
Optimize solution
1 parent 2d9deba commit 15bbe55

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)