Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Riya922003 authored Nov 1, 2024
1 parent fbe393e commit b14c3cd
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions Pattern/main.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b14c3cd

Please sign in to comment.