{"id":15008933,"url":"https://github.com/isaacarnault/python","last_synced_at":"2026-02-13T09:57:47.537Z","repository":{"id":197106718,"uuid":"159344803","full_name":"isaacarnault/Python","owner":"isaacarnault","description":"Simple permutations using Python - See original gist ⇢","archived":false,"fork":false,"pushed_at":"2019-04-24T08:38:07.000Z","size":41,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-12T10:45:55.540Z","etag":null,"topics":["python","python-2","python-3"],"latest_commit_sha":null,"homepage":"https://gist.github.com/aiPhD/f4cdef7878e88ee2bed1254a2b5fbcb5","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/isaacarnault.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-11-27T14:04:44.000Z","updated_at":"2024-07-27T22:09:53.000Z","dependencies_parsed_at":"2023-09-29T01:54:11.305Z","dependency_job_id":null,"html_url":"https://github.com/isaacarnault/Python","commit_stats":null,"previous_names":["isaacarnault/python"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/isaacarnault/Python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaacarnault%2FPython","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaacarnault%2FPython/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaacarnault%2FPython/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaacarnault%2FPython/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isaacarnault","download_url":"https://codeload.github.com/isaacarnault/Python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaacarnault%2FPython/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278510917,"owners_count":25998997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","python-2","python-3"],"created_at":"2024-09-24T19:21:47.129Z","updated_at":"2025-10-05T19:58:27.995Z","avatar_url":"https://github.com/isaacarnault.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Permutations using Python\n\n[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)\n\nOne simple program using Python for applying strings and integer permutations.\u003cbr\u003e\nThe following gist offers a program scaled in four subsets:\n* apply permutations on strings, refer to \u003cb\u003estrings_permutation.py\u003c/b\u003e\n* apply permutations on integers, refer to \u003cb\u003eintegers_permutation.py\u003c/b\u003e\n* apply permutations on both integers and strings in a single program, refer to \u003cb\u003eintegers_strings_permutation.py\u003c/b\u003e\n* use case: apply permutations on a card game, refer to \u003cb\u003euse_case_permutations.py\u003c/b\u003e.\n\n## Getting Started\n\nThis Python program built in four lines helps you avoid the use of an extented code for applying permutations on numeric data.\nThe below instructions will help you run this Python program on your local machine for development and testing purposes, as well as in third party sites hosted in the cloud.\n* (#) and (''') are used to comment the following gist.\n\n### Prerequisites\n\nI am using Jupyter Notebook on localhost (Ubuntu 18.04 bionic).\u003cbr\u003e\nMake sure to have Jupyter Notebook installed on your operating system or launch it on remote servers (see Tips).\n\n### Tips\n\nIf you are not using Linux/Unix and still want to try this simple Python program:\n* use https://labs.cognitiveclass.ai (create a free account, then click on \"JupyterLab\" in the Build Analytics section)\n* use https://dataplatform.ibm.com (recommended for IBM Coders)\n\n### Basic commands in Jupyter Notebook\n\n* Note that in Jupyter you add new lines by typing \"b\" from your keyboard whilst the notebook is opened.\n* Avoid runing the entire code in a single cell in  order to understand the steps.\n* Use \"ctrl + enter\" to execute each line if you want to get the output.\n* Use \"dd\" outside a cell to delete it.\n* Running the last cell should execute the permutations as program output.\n\nWhilst your Jupyter Notebook is open...\nUse this line of code in your first cell\n```\nfrom itertools import permutations\n\n'''\nThis loads requested package\nand library in your notebook\n'''\n```\n\nUse this line of code in your second cell\n```\nperm = permutations([3, 6, 9])\n\n'''\nThis returns no result until\nthe last cell is ran\n'''\n```\n\nUse this line of code in your third cell\n```\nfor (i) in list(perm): \nprint (i)\n\n'''\nThis completes the program, showing permutations\nof numbers 3,6,9 as output.\n'''\n```\n\n## Running the tests\n\n* I used Ubuntu (18.04 bionic) to launch Jupyter Notebook on localhost.\n* Localhost instantiates while using \u003cb\u003e$ jupyter notebook\u003c/b\u003e in the terminal.\n* Check if Jupyter is correctly installed: \u003cb\u003e$ jupyter --version\u003c/b\u003e\n\n## Built With\n\n* [Jupyter](http://jupyter.org/) - An open source software for creating notebooks\n* [Itertools](https://docs.python.org/3/library/itertools.html) - Functions creating iterators for efficient looping\n* [Math](https://docs.python.org/3/library/itertools.html) - Mathematical functions defined by the C standar\n\n## Versioning\n\nI used no vesioning system for this gist, which \u003cb\u003erepos status\u003cb\u003e is flagged as \u003cb\u003econcept\u003cb\u003e because it is intended to be a demo or POC (proof-of-concept).\n\n## Author\n\n* **Isaac Arnault** - Suggesting a minified code from *Initial work* [redspider](https://gist.github.com/redspider/3787386)\n\n## License\n\nAll public gists https://gist.github.com/aiPhD\u003cbr\u003e\nCopyright 2018, Isaac Arnault\u003cbr\u003e\nMIT License, http://www.opensource.org/licenses/mit-license.php\n\n## Use case - Applying a \u003ci\u003efactorial n\u003c/i\u003e function in a card game\n\nExtended application of the above program. Permutations are great for finding number of ways an array of integers can be sorted. Let's imagine that that we have a standard 52-card deck and we wish to find the number of permutations of four aces while shuffling the cards. We may need to add a function to our code and to use another package and libraby. Check \u003cb\u003euse_case_permutations.py\u003c/b\u003e for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaacarnault%2Fpython","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisaacarnault%2Fpython","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaacarnault%2Fpython/lists"}