Chapter 5 number of values can be divided by 3, 5 and 7 - 8 (with collection implementation) (30 minutes) Python

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

Input format:
In the line input from the keyboard two positive integers a, b (1 <= a <b <= 10000000), separated by spaces.

Output format:
the output line is greater than or less equal to the number of a number divisible by 3, 5 and 7 to be b.

Input Sample 1:
Here is given a set of inputs. E.g:

10 100

Output Sample 1:
given here corresponding output. E.g:

0

Input Sample 2:
Here is given a set of inputs. E.g:

1000 100000

Output Sample:
In the given here corresponding output. E.g:

943

a,b=map(int,input().split())
s=set()
for i in range(a,b+1):
    if i%3==0 and i%5==0 and i%7==0:
        s.add(i)
print(len(s))
Published 69 original articles · won praise 13 · views 2392

Guess you like

Origin blog.csdn.net/weixin_45948920/article/details/104705393