Untitled
unknown
python
4 years ago
378 B
9
Indexable
from itertools import permutations
lst = list(permutations('abcdefg'))
ans1 = 0
ans2 = 0
for tp in lst:
if tp.index('a') < tp.index('b') and tp.index('b') < tp.index('c') and tp.index('d') < tp.index('e'):
ans1 += 1
if tp.index('a') > tp.index('b') and tp.index('b') > tp.index('c') and tp.index('d') > tp.index('e'):
ans2 += 1
print(ans1, ans2)Editor is loading...