Created
March 30, 2015 19:25
-
-
Save fabian57/211ca0d99b32e78953ee 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
| def suffix_sequences(suffix, seq): | |
| result = [] | |
| for l in seq: | |
| result.append(l+[suffix]) | |
| return result | |
| from math import log | |
| def power_list(seq, result=[[]]): | |
| if 2**len(seq) == len(result): | |
| return result | |
| else: | |
| result += suffix_sequences(seq[int(log(len(result), 2))], result) | |
| return power_list(seq) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Si tu n'es pas bon, en tout cas tu travailles et c'est le meilleur moyen de le devenir ;)