From 73757d6b23b6192cca9204806fe1868268349f7a Mon Sep 17 00:00:00 2001 From: Hakan Date: Fri, 28 Aug 2020 22:34:46 +0200 Subject: [PATCH] commit --- .DS_Store | Bin 8196 -> 10244 bytes 029_snail.py | 48 +++++++++++------------ 030_sudoku.py | 17 ++++---- 027_max_sum_sub.py => 033_max_sum_sub.py | 0 4 files changed, 32 insertions(+), 33 deletions(-) rename 027_max_sum_sub.py => 033_max_sum_sub.py (100%) diff --git a/.DS_Store b/.DS_Store index e075092e4273a518056830a6acbfe9b78eb9e85e..7ead73e3d2514cfc59511452ced38c1479cebfd4 100644 GIT binary patch delta 866 zcmd6l!Ak-`7{$NU6r(LQTh~IuNWw!{YDGaoMcs{#L9*^jO0K(<8=WG`=oZ-CyGNI# zOVF)&28(JX@emO zo<5vM9)qzc%~GBUR3e=;GO0p!S60U}bc>wFU%YW(hzsW+v>|LD(g6e9``E~;qzd9O zE}neR%{0?5`X=+4g?Gg+1{1d{|eSpaZ^N_F6dSDjUEz_1FVL)MwWqVz5p zsN7%?&>>(G!RrvS1Jn?|gfESyaz7Py@nlqOm8e-$CZG_5O-F6?byXY)X#q~r3Nr=vbWgLKKyPtxi#YJzR(O4NQ5+KuARJk P@F`2a|MPZ2y|?oX6L-`a delta 199 zcmZn(XmOBWU|?W$DortDU;r^WfEYvza8FDWo2aMAD77(QH$S7)WF7&@IEKlqfl@3C zdJO3dnG7Yl`7SO=Ir&K-ZT1z<4Nk=$azvF+!7E>oVHlj8pIZRb!@$6NVRN&<4z|g! tCC>;lgGCr5xPi1Q$SoTazcWwfR|(``gt(Alay-xU&HqJgn1Jd}0szpJE;9fC diff --git a/029_snail.py b/029_snail.py index 076e490..b9889df 100644 --- a/029_snail.py +++ b/029_snail.py @@ -12,27 +12,27 @@ def snail(array): print(snail(array)) -def snail(array): - dizi= [] - n = len(array) - while n>0: - if array==[[]]: break - for i in range(len(array)-1): - if i == 0: - dizi.extend(array[i]) - array.pop(i) - n -= 1 - dizi.append(array[i][-1]) - else: - dizi.append(array[i][-1]) - for i in range(len(array)-1,-1,-1): - dizi.append(array[-1][i]) - array.pop(-1) - n -= 1 - for i in range(len(array)-1,-1,-1): - dizi.append(array[i][0]) - array2=[] - for i in array: - array2.append(i[1:-1]) - array = array2 - return dizi \ No newline at end of file +# def snail(array): +# dizi= [] +# n = len(array) +# while n>0: +# if array==[[]]: break +# for i in range(len(array)-1): +# if i == 0: +# dizi.extend(array[i]) +# array.pop(i) +# n -= 1 +# dizi.append(array[i][-1]) +# else: +# dizi.append(array[i][-1]) +# for i in range(len(array)-1,-1,-1): +# dizi.append(array[-1][i]) +# array.pop(-1) +# n -= 1 +# for i in range(len(array)-1,-1,-1): +# dizi.append(array[i][0]) +# array2=[] +# for i in array: +# array2.append(i[1:-1]) +# array = array2 +# return dizi \ No newline at end of file diff --git a/030_sudoku.py b/030_sudoku.py index eba4aaa..f4eafd4 100644 --- a/030_sudoku.py +++ b/030_sudoku.py @@ -15,11 +15,10 @@ def valid_solution(board): dik = [list(map(lambda x:x[a],board)) for a in range(len(board))] - # dik = [] # for a in range(len(board)) # dik.extend(list(map(lambda x:x[a],board))) - + print(dik) k_dokuz=[list(map(lambda x:x[i:i+3],board[k:k+3])) for i in range(0,9,3)\ for k in range(0,9,3)] @@ -27,17 +26,17 @@ def valid_solution(board): # for k in range(0,9,3): # for i in range(0,9,3): # k_dokuz.extend(list(map(lambda x:x[i:i+3],board[k:k+3]))) - + print(k_dokuz) k_dokuz= [i[0]+i[1]+i[2] for i in k_dokuz] # y_k_dokuz = [] # for i in k_dokuz: # y_k_dokuz += [i[0]+i[1]+i[2]] - for i in board,dik,k_dokuz: - for k in i: - if set(k)!={1,2,3,4,5,6,7,8,9}: - return False - break + for i in board,dik,k_dokuz: + for k in i: + if set(k)!={1,2,3,4,5,6,7,8,9}: return False; break return True -# print(valid_solution(board)) \ No newline at end of file +# print(valid_solution(board)) + +print(valid_solution(board)) \ No newline at end of file diff --git a/027_max_sum_sub.py b/033_max_sum_sub.py similarity index 100% rename from 027_max_sum_sub.py rename to 033_max_sum_sub.py