Print Star Pattern

Print a right-angled triangle star pattern using nested loops.

BeginnerTopic: Loop Programs
Back

Python Print Star Pattern Program

This program helps you to learn the fundamental structure and syntax of Python programming.

Try This Code
# Program to print a right-angled star pattern

rows = int(input("Enter number of rows: "))

for i in range(1, rows + 1):
    print("*" * i)
Output
Enter number of rows: 4
*
**
***
****

Understanding Print Star Pattern

We print each row as "*" repeated i times, leveraging string multiplication.

Note: To write and run Python programs, you need to set up the local environment on your computer. Refer to the complete article Setting up Python Development Environment. If you do not want to set up the local environment on your computer, you can also use online IDE to write and run your Python programs.

Table of Contents