Python Permutations

This simply how to implement the module of permutations in python.

>>> from itertools import permutations
>>>
>>> perms = [''.join(p)+"@gmail.com" for p in permutations('abc', 3)]
>>> for email in perms:
...     print(email)
...
abc@gmail.com
acb@gmail.com
bac@gmail.com
bca@gmail.com
cab@gmail.com
cba@gmail.com
>>>
AM

Written by Agus Makmun Author

SDE Lead working across the whole stack: backend, frontend, databases and the infrastructure that ships them. These days mostly infrastructure and Next.js, like moving apps off Vercel and Supabase to self-hosted.

arrow_backPrevious post Simple bash scripting for login before open the terminal
search esc