Thursday, December 27, 2018

Pattern(python 2.7.15)

SOME IMPORTANT PATTERN IN PYTHON 2.7.15 PROGRAMMING LANGUAGE














Question 1.                                                                                                     OUTPUT:                                                               
                                                                                                  
n=input("enter any number")
for i in range(n):                                                        
    print("*")*i                                                            
print("*")*(i+1)                                                            
for i in range(n,0,-1):                                                 
    print("*")*i                                                 





Question 2..
  
n=int(input("enter the number"))
print("\n")
for i in range(0,n):
    print("  ")*i,
    for j in range(n,i,-1):
        print("*"),
    print

enter the number6

     * * * * * *
        * * * * *
           * * * *
              * * *
                 * *
                    *


Question 3.
for i in range(4,-1,-1):
    print("  ")*i,
    for j in range(5,i,-1):
        print("*"),
    for k in range(4,i,-1):
            print("*"),
    print

OUTPUT::::

             *
          * * *
       * * * * *
    * * * * * * *
 * * * * * * * * *

QUESTION  4.
for i in range(4,-1,-1):
    print("  ")*i,
    for j in range(5,i,-1):
        print("*"),
    for k in range(4,i,-1):
            print("*"),
    print

for i in range(1,5):
    print("  ")*i,
    for j in range(4,i-1,-1):
        print("*"),
    for k in range(4,i,-1):
        print("*"),
print

OUTPUT:::

             *
          * * *
       * * * * *
    * * * * * * *
 * * * * * * * * *
    * * * * * * *
       * * * * *
          * * *
             *

Question 5.
k=1
for i in range(1,8):
    if (i%2!=0):
        print("+-+-+-+-+-+")
    else:
        for j in range(1,4):
            print "|",k,
            k=k+1
        print(“|”)
        print

OUTPUR::..

+-+-+-+
| 1 | 2 | 3|
+-+-+-+
| 4 | 5 | 6|
+-+-+-+
| 7 | 8 | 9|                         


Arrays in Solidity Programming Language.

Arrays Solidity supports both generic and byte arrays. It supports both fixed size and dynamic arrays. It also supports multidimensional ...