Python 3 Script to Print Square Star Pattern or Any Custom Symbol Using For and While Loop Full Project For Beginners

Python 3 Script to Print Square Star Pattern or Any Custom Symbol Using For and While Loop Full Project For Beginners

 

Welcome folks today in this blog post we will be printing square star pattern or any custom sybmol using for loop and while loop in python.All the full source code of the application is given below.

 

 

Get Started

 

 

In order to get started you need to make an app.py file and copy paste the following code

 

Printing Square Pattern Using For Loop

 

app.py

 

# Python Program to Print Square Star Pattern
 
side = int(input("Please Enter any Side of a Square  : "))
symbol = input("Enter the Sybmol")

print("Square Star Pattern") 

for i in range(side):
    for i in range(side):
        print(symbol, end= '  ')
    print()

 

See also  Python 3 Web Scraping Script to Scrape ICC Players Rankings in CSV Files Using BeautifulSoup4 and Pandas Library Full Project For Beginners

 

Now if you execute the python script by typing the below command as shown below

 

python app.py

 

 

 

Printing Square Pattern using While Loop

 

 

app.py

 

# Python Program to Print Square Star Pattern
 
side = int(input("Please Enter any Side of a Square  : "))
i = 0
print("Square Star Pattern") 

while(i < side):
    j = 0
    while(j < side):      
        j = j + 1
        print('*', end = '  ')
    i = i + 1
    print('')

Leave a Reply