Logic Building
# Take n
n = int(input("Enter number of rows: "))
# Print inverted triangle
for i in range(n, 0, -1):
for j in range(1, i + 1):
print("*", end="")
print()Output
Enter number of rows: 5 ***** **** *** ** *
Start from n and decrease.
Key Concepts:
- Outer loop: n down to 1
- Inner loop: print i stars
- Decreasing pattern