Changeset 1196 in lmdz_wrf for trunk/tools
- Timestamp:
- Oct 18, 2016, 4:29:08 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r1195 r1196 302 302 Num= number of elements 303 303 >>> list_norepeatcombos(4) 304 [[0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3], [0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3] ]304 [[0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3], [0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3], [0, 1, 2, 3]] 305 305 """ 306 306 from math import factorial … … 318 318 Nlvs = len(listv) 319 319 # Number of possible combinations 320 for ic in range(2,Nlvs ):320 for ic in range(2,Nlvs+1): 321 321 Ncombs = factorial(Nlvs)/(factorial(ic)*factorial(Nlvs-ic)) 322 322 combo = range(ic)
Note: See TracChangeset
for help on using the changeset viewer.