Python - Pull random numbers from a list. Populate a new list with a specified length and sum
问题 I am trying to create a function where: The output list is generated from random numbers from the input list The output list is a specified length and adds to a specified sum ex. I specify that I want a list that is 4 in length and adds up to 10. random numbers are pulled from the input list until the criteria is satisfied. I feel like I am approaching this problem all wrong trying to use recursion. Any help will be greatly appreciated!!! EDIT: for more context on this problem.... Its going