Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- L = [[1,1,1,1,1,1,1],
- [2,4,4,2,1,2,4],
- [1,1,1,1,1,1,1],
- [1,1,1,1,1,1,1],
- [1,1,1,1,1,1,1],
- [1,1,1,1,1,1,1]]
- def sum_cols(L):
- horz_lng = len(L[0])
- vert_lng = len(L)
- col = 0
- sums = []
- for y in range(horz_lng):
- col = 0
- for x in range(vert_lng):
- col += L[x][y]
- sums.append(col)
- return sums
- print(sum_cols(L))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement