CODE to Print a square(hollow) in python

Print a square(hollow) in python


n=int(input("enter any number"))
i=1
while(i<=n):
    if(i==1 or i==n):
        print("*"*n)
       
    else:
         print("*",end="")
         print(" "*(n-2),end="")
         print("*")
       
    i+=1



OUTPUT :




THANKYOU

Comments

Popular posts from this blog

CODE to print rhombus in python

printing triangle pattern using for loops in c++