Форум » Кодирование и декодирование информации » задание 8 №4256 » Ответить

задание 8 №4256

Пичугина: ответ на 4 меньше [pre2]from itertools import * n=0 s=[] for i in set(permutations('КУСАТЬ')): if i not in s and i[0]!='Ь' and 'СУК' not in ''.join(i): n+=1 s.append(''.join(i)) print(s) print(n)[/pre2]

Ответов - 2

MrAndrewson: Нужны 5-буквенные слова. А у вас 6-буквенные.

polyakovss: Здравствуйте! permutations? Возможное решение: [pre2] from itertools import product s = map(lambda x: ''.join(x), product('КУСАТЬ',repeat=5)) print(len([x for x in s if len(set(x)) == 5 and x[0] != 'Ь' and 'СУК' not in x]))[/pre2]



полная версия страницы