python - nested if statements based on values in an array -
i try check several modules of numbers based on values of array. array = [1,2,3,4,5] number = 10 now want automate following: if 10%1 ==0: if 10%2 == 0: if 10%3 == 0: if 10%4 == 0: if 10%5 ==0: print "10 dividable numbers in array" i want make number of nested if statements based on length of array , number check if 10 dividable out of array. there way loops? thanks. use all : array = [1,2,3,4,5] number = 10 if all(number % x == 0 x in array): print "%s dividable %s" % (str(number), str(array))