08-03-2023, 04:49 PM
(08-03-2023, 04:44 PM)Snoopy Wrote: rules approach is okay, but you have to genrate all possibilites for the whole length of your pass, i made a python function for this, for a given string
Code:def lower_upper_permutationen_string(string):
lower_upper = ((char.lower(), char.upper()) for char in string)
tmp_list =[''.join(product) for product in itertools.product(*lower_upper)]
result = sorted(list(set(tmp_list)))
return result
when runnnning this with string 'test' will result in all possibilities of test upper/ lower for test 4^2 = 16 possibilities
Code:['TEST', 'TESt', 'TEsT', 'TEst', 'TeST', 'TeSt', 'TesT', 'Test', 'tEST', 'tESt', 'tEsT', 'tEst', 'teST', 'teSt', 'tesT', 'test']
Thanks snoopy!