Pages

Tuesday, 15 March 2016

Alphabet A of Asterick "*"

# To print Alphabet A of Asterick '*'
# Set your font type As Courier
n=int(raw_input("Enter a Number : "))
m=n
n=(n-1)/2
a=-1
for i in range(n) :
    print (m-1)*" ",
    print "*",
    for k in range(a) :
        print " ",
    if a==-1 :
        print
    else :
        print "*"
    a=a+1
    m=m-1
print (m-1)*" ",
m=m-1
a=a+1
for i in range(n+1) :
    print "*",
print
for i in range(n) :
    print (m-1)*" ",
    print "*",
    for k in range(a) :
        print " ",
    print "*"
    a=a+1
    m=m-1

OUTPUT
Enter a Number : 9
         *
        * *
       *   *
      *     *
     * * * * *
    *         *
   *           *
  *             *
 *               *