Python - K length Combinations from given characters
Given a string, generate K-length combinations in a one-liner. Input : test_str = 'gfg', K = 3 Output : ['ggg', 'ggf', 'ggg', 'gfg', 'gff', 'gfg', 'ggg', 'ggf', 'ggg', 'fgg', 'fgf', 'fgg', 'ffg', 'fff', 'ffg', 'fgg', 'fgf', 'fgg', 'ggg', 'ggf', 'ggg', 'gfg', 'gff', 'gfg', 'ggg', 'ggf', 'ggg'] Explan