Pages

Wednesday, 23 March 2016

Alphabet D Of Asterick '*'

# To print Alphabet D of Asterick '*'
# Set your font type As Courier New


n=int(raw_input("Enter a Number : "))
m=n
n=(n-1)/2
for i in range(n) :
    print "*",
print
for i in range(m-2) :
    print "*",
    for i in range(n-1) :
        print " ",
    print "*"
for i in range(n) :
    print "*",
print

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

Sunday, 20 March 2016

Alphabet C Of Asterick '*'

# To print Alphabet C of Asterick '*'
# Set your font type As Courier New

n=int(raw_input("Enter a Number : "))
n=(n-1)/2
print " ",
for i in range(n) :
    print "*",
print
for i in range(2*n-1) :
    print "*"
print " ",
for i in range(n) :
    print "*",
print

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

Tuesday, 15 March 2016

Alphabet B of Asterick "*"

# To print Alphabet B of Asterick '*'
# Set your font type As Courier

n=int(raw_input("Enter a Number : "))
n=(n-1)/2
for i in range(n) :
    print "*",
print
for i in range(n-1) :
    print "*",
    for i in range(n-1) :
        print " ",
    print "*"
for i in range(n) :
    print "*",
print
for i in range(n-1) :
    print "*",
    for i in range(n-1) :
        print " ",
    print "*"
for i in range(n) :
    print "*",
print

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

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
         *
        * *
       *   *
      *     *
     * * * * *
    *         *
   *           *
  *             *
 *               *


Thursday, 10 March 2016

Pallindrome String

# WAP to check if a string is pallindrome or not
# Set Your Font as Courier New

z=raw_input("Enter a string: ")
z.lower()
for i in range(-len(z),0) :
x=x+z[i]
if x==z :
print "Given String is Pallindrome"
else :
print "Given String is not a Pallindrome"

Output 1
Enter a string: aIbohPhoBiA
Given String is Pallindrome

Output 2
Enter a string: palindrome
Given String is not a Pallindrome