Exercise Python - can be counted number divisible by 3, 5 and 7 (set implemented)

Exercise Python - can be counted number divisible by 3, 5 and 7 (set implemented)

3, 5 and 7 can be divisible by the number of the required number of the designated section

Input formats:

Input from the keyboard in a row two positive integers a, b (1 <= a <b <= 10000000), separated by spaces.

Output formats:

In a line of output is greater than or equal to b and less than or equal to the number of the number 3, 5 and 7 can be divisible.

Sample Input 1:

Here we are given a set of inputs. For example:
10100

Output Sample 1:

Given here corresponding output. For example:
0

Sample Input 2:

Here we are given a set of inputs. For example:
1000100000

Sample output:

Given here corresponding output. For example:
943

analysis:

First deposit to meet the requirements of the list, and then set to heavy.

a,b = map(int,input().split())
l = []
for i in range(a,b+1):
    if i%(3*5*7)==0:
        l.append(i)
l = set(l)
print(len(l))
Published 180 original articles · won praise 7 · views 9340

Guess you like

Origin blog.csdn.net/linjiayina/article/details/104410026