-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpermos and combos.py
42 lines (38 loc) · 956 Bytes
/
permos and combos.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
37
38
39
40
41
42
from itertools import permutations as P, combinations as C, combinations_with_replacement as CR
substrate = [2,3,4,5,6,7,8,9,10]
choose = 3
##permutations (order matters) w/ replacement
#perm_rep = choose**len(substrate)
#print('permutations w/ replacement')
#print(perm_rep)
#print(' ')
#
##permutations (order matters) NO replacement
#print('permutations NO replacement')
#perm = P(substrate,choose)
#count = 0
#for i in list(perm):
# count+=1
## print(i)
#print(count)
#print(' ')
#combinations (order does NOT matter) w/ replacement
print('combinations w/ replacement')
comb = CR(substrate,choose)
count = 0
for i in list(comb):
count+=1
print(i)
print(count)
print(' ')
#combinations (order does NOT matter) NO replacement
#print('combinations NO replacement')
#comb = C(substrate,choose)
#count = 0
#for i in list(comb):
# count+=1
## print(i)
#print(count)
#print(' ')
#when probability is different
#use np.random.choice