This Python program reads the number of rows from the user and prints a pattern using asterisks (*) that resembles the letter "P" rotated 90 degrees counterclockwise.
The pattern consists of a left-aligned triangle followed by a horizontal line at the bottom.
def draw_rotated_p(rows):
# Upper triangle part
for i in range(1, rows):
print("*" * i)
# Bottom horizontal line
print("*" * rows)
# Run the program
rows = int(input("Enter number of rows: "))
draw_rotated_p(rows)
*
**
***
****
*****
- The first loop prints a left-aligned triangle with increasing number of asterisks
- The final line prints a full horizontal row of asterisks equal to the number of rows
- This creates a shape similar to the letter "P" rotated counterclockwise