1
1
Level description
Level Description
Level 1 Beginner means someone who has just gone through an introductory
Python
course. He can solve some problems with 1 or 2 Python classes or
functions.
Normally, the answers could directly be found in the textbooks.
Level 2 Intermediate means someone who has just learned Python, but
already has a
relatively strong programming background from before. He should be able to
solve
problems which may involve 3 or 3 Python classes or functions. The answers
cannot
be directly be found in the textbooks.
Level 3 Advanced. He should use Python to solve more complex problem using
more
rich libraries functions and data structures and algorithms. He is
supposed to
solve the problem using several Python standard packages and advanced
techniques.
Question:
Write a program which will find all such numbers which are divisible by 7
but are
not a multiple of 5,
between 2000 and 3200 (both included).
The numbers obtained should be printed in a comma‐separated sequence on a
single
line.
Hints:
Consider use range(#begin, #end) method
Solution:
l=[]
for i in range(2000, 3201):
if (i%7==0) and (i%5!=0):
l.append(str(i))
print ','.join(l)