Skip to content

Instantly share code, notes, and snippets.

@iamsibasish
Created August 16, 2018 13:25
Show Gist options
  • Save iamsibasish/cd9621c6f91663d4e14926ea9d48dfde to your computer and use it in GitHub Desktop.
Save iamsibasish/cd9621c6f91663d4e14926ea9d48dfde to your computer and use it in GitHub Desktop.
Make A Table created by sibasishmohanty - https://repl.it/@sibasishmohanty/Make-A-Table
def pr(arr,k):
count_arr = []
for i in arr:
count_arr.append(numberOfDigits(i))
max_l = max(count_arr)
n = len(arr)
a= 1
b = 0
while(n>0):
if n<=k:
k=n
if (a==1):
for i in range(0,2*k+1):
if i&1 == 1:
for j in range(0,max_l):
print("-",end="")
else:
print("*",end="")
print("")
for i in range(0,2*k+1):
if i&1 == 1:
x = max_l-count_arr[b]
for z in range(0,x):
print(" ",end="")
print(arr[b],end="")
b+=1
else:
print("|",end="")
print("")
for i in range(0,2*k+1):
if i&1 == 1:
for j in range(0,max_l):
print("-",end="")
else:
print("*",end="")
print("")
n = n-k
a =0
def numberOfDigits(dig):
return len(str(dig))
a = [33,4,4,522,221,2,939,4444,2]
pr(a,3)
# chk for 0 and -ve
a = [51019,51020,51021,51022,51023,25557,25558,25559,25560,25561,45719,45720,45721,45722,45723,35160,35161,35162,35163,35164,40403,40404,40405,40406,40407,16080,16081,16082,16083,16084,50872,50873,50874,50896,50897]
print(len(a))
def solution(A):
# write your code in Python 3.6
n = len(A)
c=0
for p in range (0,n):
m = len(A[p])
for q in range(0,m):
if p != 0 and q !=0 and p != n-1 and q!= m-1:
if ((A[p][q]<A[p][q-1] and A[p][q]<A[p][q+1]) and (A[p][q]>A[p+1][q] and A[p][q]>A[p-1][q])) or ((A[p][q]>A[p][q-1] and A[p][q]>A[p][q+1]) and (A[p][q]<A[p+1][q] and A[p][q]<A[p-1][q])):
c+=1
return c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment