how to generate the following list from the following dictionary
d = {2: 4, 3: 1, 5: 3}f = [2**1,2**2, 2**3, 2**4, 3**1, 5**1, 5**2, 5**3, 2**1 * 3, 2**2 * 3, 2**3 * 3, 2**4 * 3, 5**1 * 3, 5**2 * 3, 5**3 * 3, 2**1 * 5, 2**2 * 5, 2**3 * 5, 2**4 * 5, 2**1 * 5**2, 2**2 * 5**2, 2**3 * 5**2, 2**4 * 5**2, 3**1 * 5**2, 2**1 * 5**3, 2**2 * 5**3, 2**3 * 5**3, 2**4 * 5**3, 3**1 * 5**3, 2**1 * 3**1 * 5**1, 2**1 * 3**1 * 5**2, 2**1 * 3**1 * 5**3, 2**2 * 3**1 * 5**1, 2**2 * 3**1 * 5**2, 2**2 * 3**1 * 5**3, 2**3 * 3**1 * 5**1, 2**3 * 3**1 * 5**2, 2**3 * 3**1 * 5**3, 2**4 * 3**1 * 5**1, 2**4 * 3**1 * 5**2, 2**4 * 3**1 * 5**3, ]
Moreover I want to expand for more general case ie dictionary of k key-value pairs
Edit: Explanation of the pattern: Each key is raised to power of 0 to it's value and after that for each of those terms we do combination with similar terms from other keys.
I can think of doing so in recursive ways. Any non recusive approach is welcome.
PS: Order is not important