Created
March 17, 2019 17:25
-
-
Save bmweiner/ede9b8a95203642cd3d1e191ac442933 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"('A',)\n", | |
"('B',)\n", | |
"('C',)\n", | |
"('D',)\n", | |
"('A', 'B')\n", | |
"('A', 'C')\n", | |
"('A', 'D')\n", | |
"('B', 'C')\n", | |
"('B', 'D')\n", | |
"('C', 'D')\n", | |
"('A', 'B', 'C')\n", | |
"('A', 'B', 'D')\n", | |
"('A', 'C', 'D')\n", | |
"('B', 'C', 'D')\n", | |
"('A', 'B', 'C', 'D')\n" | |
] | |
} | |
], | |
"source": [ | |
"import itertools\n", | |
"\n", | |
"s = 'ABCD'\n", | |
"for l in range(1, len(s) + 1):\n", | |
" for c in itertools.combinations(s, l):\n", | |
" print(c)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.7.0" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment