Python Star Pattern | Create 1 star

In this blog we will be going through an interesting program i.e., printing a start pattern using python programming language. We need to provide the column count and based on which stars are printed.

So let’s break down our program and understand line by line.

There are just two steps in which you can accomplish this task.

capture the number of rows

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
rows = int(input("Enter the number of rows: "))
rows = int(input("Enter the number of rows: "))
rows = int(input("Enter the number of rows: "))

run the for loop based on the number provided by user

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
for i in range(1, rows + 1):
for i in range(1, rows + 1):
for i in range(1, rows + 1):

and then print it on the screen that’s it !!!

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
print("*" * i)
print("*" * i)
print("*" * i)

Python Star Pattern will be printed by the following code.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
rows = int(input("Enter the number of rows: "))
for i in range(1, rows + 1):
print("*" * i)
rows = int(input("Enter the number of rows: ")) for i in range(1, rows + 1): print("*" * i)
rows = int(input("Enter the number of rows: "))

for i in range(1, rows + 1):
    print("*" * i)