Create a Square Shape with Odd Number Pattern in Python

thumbnail

In this tutorial, you will create a square shape with odd number pattern in python. You don’t have to import any library. The source code is show as follows.

# Created by inpows
# Visit inpows.com for more python tutorials

n = int(input("Enter number:"))
n = n*2
for i in range(1,n+1,2):
    for j in range(i,n+i,2):
        print((j-1)%n+1,end="")
    print("")
Enter number: 5
13579
35791
57913
79135
91357
Back To Top