MCPcopy Create free account
hub / github.com/google-deepmind/alphageometry / reshape

Function reshape

problem.py:33–38  ·  view source on GitHub ↗
(l: list[Any], n: int = 1)

Source from the content-addressed store, hash-verified

31
32
33def reshape(l: list[Any], n: int = 1) -> list[list[Any]]:
34 assert len(l) % n == 0
35 columns = [[] for i in range(n)]
36 for i, x in enumerate(l):
37 columns[i % n].append(x)
38 return zip(*columns)
39
40
41def isint(x: str) -> bool:

Callers 2

from_txt_fileMethod · 0.85
from_stringMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected