Python Program to Print Square Pattern

This python program generates or prints square pattern made up of stars up to n lines.

Python Source Code: Square Pattern


# Square Pattern Using Star

# Reading number of rows
row = int(input("Enter number of rows: "))

print("Square pattern is: ")
for i in range(1,row+1):
    for j in range(1,row+1):
        print("*", end="")
    print()

Output: Square Pattern

Enter number of rows: 8
Square pattern is: 

********
********
********
********
********
********
********
********