diff --git a/new_pattern.py b/new_pattern.py index e9ebc1c257c..6c5120eb586 100644 --- a/new_pattern.py +++ b/new_pattern.py @@ -12,14 +12,14 @@ def main(): lines = int(input("Enter no.of lines: ")) pattern(lines) -def pattern(lines): - t = 1 - for i in reversed(range(lines)): - nxt_pattern = "$"*t - pattern = "@"*(i+1) - final_pattern = pattern + " n " + nxt_pattern - print(final_pattern) - t = t +1 +def pattern(lines): + t = 1 + for i in range(lines,0,-1): + nxt_pattern = "$"*t + pattern = "@"*(i) + final_pattern = pattern + " " + nxt_pattern + print(final_pattern) + t = t +1 if __name__ == "__main__": - main() \ No newline at end of file + main()