Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python pattern of 1010101

"""
1 0 1 0 1 0 1 
  1 0 1 0 1 
    1 0 1 
      1 
"""
n = 4
for i in range(n):
    for j in range(i+1):
        print(" ",end=" ")
    for k in range(2 * (n - i) - 1):
        if k%2==0:
            print("1", end=" ")
        else:
            print("0",end=" ")
    print()
 
PREVIOUS NEXT
Tagged: #Python #pattern
ADD COMMENT
Topic
Name
1+6 =