# Question: if i have a list of 40 numbers and i...

###### Question details

If I have a list of 40 numbers and I want to select 5 numbers and test if their sum equals a certain constant, In python ?

Suppose I have a list [a1,a2.....a40], then I want to select a2,a3,a7,a8,a9 and check if a2+a3+a7+a8+a9=500 if yes I print it and then select other 5 numbers from the main array and check for the sum,keep repeating until and unless I've used all possible combinations.How to do so in python ?