Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import product
- a = list(map(''.join, product('ПИР', repeat=5)))
- # Первый способ
- words = []
- for i in a:
- if i.count('П') == 1:
- words.append(i)
- print(len(words))
- # Второй способ
- print(len(list(filter(lambda x: x.count('П') == 1, a))))
Advertisement
Add Comment
Please, Sign In to add comment