Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import permutations
- words = permutations('ОСЕНЬЮПРИЗЫВ')
- cnt = 0
- for i in words:
- if all((i[n] in 'ОЕЬЮИЫ' and i[n+1] in 'ОЕЬЮИЫ') for n in range(0, 12, 4)):
- if all((i[n] in 'СНПРЗВ' and i[n+1] in 'СНПРЗВ') for n in range(2, 12, 4)):
- cnt += 2
- #elif all((i[n] in 'ОЕЬЮИЫ' and i[n + 1] in 'ОЕЬЮИЫ') for n in range(2, 12, 4)):
- # if all((i[n] in 'СНПРЗВ' and i[n + 1] in 'СНПРЗВ') for n in range(0, 12, 4)):
- # print(i)
- # cnt += 1
- print(cnt)
Advertisement
Add Comment
Please, Sign In to add comment