This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let hintcharacters = "asdfjkl;" | |
unmap w P W o <S-Esc> ? E Y i I \ [ ] = - 0 | t p x J K u s S / n N H L . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
matrix = [ | |
[1, 2, 3], | |
[4, 5, 6], | |
[7, 8, 9] | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
matrix[2][1] # => 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for row in matrix: | |
print(*row) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rep = [' '.join(map(str, matrix[r:r + cols])) for r in range(0, len(matrix), cols)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for r in range(len(matrix)): | |
for c in range(len(r)): | |
matrix[r][c] += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new_matrix = [] | |
new_rows = 9 | |
new_cols = 1 | |
temp = [] | |
for row in matrix: | |
temp += row | |
for r in range(new_rows): | |
new_matrix.append([temp[r * new_cols + c] for c in range(new_cols)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
temp = [] | |
for row in matrix: | |
temp += row |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
temp[r * new_cols + c] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rows = 3 | |
cols = 3 | |
matrix = [ | |
1, 2, 3, | |
4, 5, 6, | |
7, 8, 9 | |
] |