Skip to content

Commit 5de4480

Browse files
authored
modified pattern2.py
previously it is showing some error and not printing proper no of lines
1 parent 07f7428 commit 5de4480

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

Patterns/pattern2.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,15 @@ def main():
1313
pattern(lines)
1414

1515
def pattern(lines):
16-
t = 0
17-
m = lines + 1
18-
for i in reversed(range(lines+1)):
19-
pattern = "@"*(m)
20-
format = " "*t
21-
t = t + 1
22-
print(format + pattern)
23-
m = m -2
24-
if m <= 0:
25-
exit()
16+
for i in range(lines,0,-1):
17+
for j in range(lines-i):
18+
print(' ', end='')
19+
20+
for j in range(2*i-1):
21+
print('$',end='')
22+
print()
23+
2624

2725
if __name__ == "__main__":
2826
main()
27+

0 commit comments

Comments
 (0)