From b14c3cdc3472f63aa885e03f1e2bfb1c81b22850 Mon Sep 17 00:00:00 2001 From: Riya Gupta <139098932+Riya922003@users.noreply.github.com> Date: Fri, 1 Nov 2024 19:53:48 +0530 Subject: [PATCH] Update main.py --- Pattern/main.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/Pattern/main.py b/Pattern/main.py index 58d1881..e913e2e 100644 --- a/Pattern/main.py +++ b/Pattern/main.py @@ -1,29 +1,25 @@ - +# Pattern 1: Square Pattern for i in range(4): - for i in range(4): - print("# ", end="") + for j in range(4): # Use 'j' as the inner loop variable + print("# ", end="") # Print '#' without a newline - print() + print() # Move to the next line after each row print("Using Pattern 1") +print("") # Print a blank line for spacing -print("") - -# printing in pattern - +# Pattern 2: Right-Angled Triangle (Left-Aligned) +print("Using Pattern 1") for i in range(4): - for j in range(i + 1): + for j in range(i + 1): # Print increasing number of '#' print("# ", end="") - print() - + print() # Move to the next line after each row print("Using Pattern 2") - -# printing in pattern - +# Pattern 3: Inverted Right-Angled Triangle for i in range(4): - for j in range(4 - i): + for j in range(4 - i): # Print decreasing number of '#' print("# ", end="") - print() + print() # Move to the next line after each row