Skip to content

Instantly share code, notes, and snippets.

@joaofig
Created July 2, 2023 11:13
Show Gist options
  • Select an option

  • Save joaofig/427eb0cfff40c1cf5cef9c9aa4f5b411 to your computer and use it in GitHub Desktop.

Select an option

Save joaofig/427eb0cfff40c1cf5cef9c9aa4f5b411 to your computer and use it in GitHub Desktop.
Generates the list of triples from a token list
def generate_triples(hex_list: list[int]) -> list[(int,int,int)]:
triples = []
if len(hex_list) > 2:
for i in range(len(hex_list) - 2):
t0, t1, t2 = hex_list[i:i + 3]
triples.append((t0, t1, t2))
return triples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment