Skip to content

Commit 4a1b1cf

Browse files
Add solution for connect4: placing tokens
1 parent e703923 commit 4a1b1cf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""Kata url: https://www.codewars.com/kata/5864f90473bd9c4b47000057."""
2+
3+
def connect_four_place(columns):
4+
board = [[] for _ in range(7)]
5+
6+
for turn, col in enumerate(columns):
7+
board[col].append("YR"[turn & 1])
8+
9+
final_board = [''.join(col).ljust(6, '-') for col in board]
10+
return [[*l] for l in zip(*final_board)][::-1]

0 commit comments

Comments
 (0)