-
Notifications
You must be signed in to change notification settings - Fork 1
/
combinations.py
36 lines (31 loc) · 992 Bytes
/
combinations.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri May 12 00:35:17 2017
@author: PereiraJoao
"""
from collections import OrderedDict
def stringersamount(NS):
comb = []
lst = [0,1,2,3,4,5] # List of data which combinations are to be calculated for
count = NS
if NS == 4:
for j in range (6):
for i in range (6):
for k in range (6):
for s in range (6):
opt = [lst[j],lst[i],lst[k],lst[s]]
comb.append(opt)
elif NS ==3:
for j in range (6):
for i in range (6):
for k in range (6):
opt = [lst[j],lst[i],lst[k]]
comb.append(opt)
elif NS == 2:
for j in range (6):
for i in range(6):
opt = [lst[j],lst[i]]
comb.append(opt)
comb1 = map(list, OrderedDict.fromkeys(map(tuple,comb)))
return comb1