Answer the question
In order to leave comments, you need to log in
How to generate options?
Hello. Tell the function how to generate all possible options and save them to a list.
For example:
name = 'sasha'
surname = 'petrov'
birth_date = '11/01/1985' # here it is also desirable to split by a dot
nickname
=
'sanek' sashasanek,
etc. In general, to get all possible combinations of these values. There are 6 of them here.
Answer the question
In order to leave comments, you need to log in
from itertools import permutations
name = 'sasha'
surname = 'petrov'
birth_date = '11.01.1985' # тут еще желательно разбить по точке
nickname = 'sanek'
for j in range(3):
for im in permutations(birth_date.split('.'), j+1):
for x in permutations([name, surname, nickname, ''.join(im)], 2):
print(''.join(x))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question