# open data file data = open("pr00.txt") # take out the first line: we don't need it! line1 = data.readline() # process each line separately for line in data: line = line.strip().split() # first token is the number to divide one = int(line[0]) # loop over the rest of the numbers count = 0 for num in line[1:]: if int(num) != 0 and one % int(num) == 0: count += 1 print count, "of the numbers go evenly into", one