Last active
July 20, 2023 12:59
-
-
Save raspi/b4c82b0170b2a8b19fb50369906681d6 to your computer and use it in GitHub Desktop.
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
from itertools import permutations | |
from typing import Generator, List | |
def gen(s: List[str]) -> Generator: | |
for i in permutations(s, len(s)): | |
yield list(i) | |
def acro(a:List[str]) -> Generator: | |
for i in gen(a): | |
firsts:List[str] = [] | |
for item in i: | |
firsts.append(item[0]) | |
yield firsts, i | |
if __name__ == '__main__': | |
a = ['PostgreSQL', 'Go', 'HTMX', 'Linux'] | |
for i in acro(a): | |
a, b = i | |
print("".join(a), " ".join(b)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment