From ea2e0ea0d517f862f51baff2f1f6943e2f1e03e0 Mon Sep 17 00:00:00 2001 From: MohamedAmineDerouiche Date: Wed, 4 Nov 2020 17:51:31 +0100 Subject: [PATCH 1/2] chalenge 2 --- README.md | 5 ++--- script.py | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index de919df..6c2d008 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,5 @@ A. Write a Python script which will find all numbers that are : HINT: Consider use range(#begin, #end) method B. Update this README.md with the insctruction(s) needed to run that script -```shell - -``` \ No newline at end of file +link:https://docs.python.org/3/tutorial/index.html +add a commande python script.py to begin the script \ No newline at end of file diff --git a/script.py b/script.py index 6e2f59b..f071de9 100644 --- a/script.py +++ b/script.py @@ -25,5 +25,11 @@ ######### # INSERT YOUR CODE BELOW THIS LINE +results=[] +for x in range(2000, 3201): + if (x%7==0) and (x%5!=0): + results.append(str(x)) + +print ','.join(results) ######### From 29a220e6ec04ab8d8fd7dbbf1678f18468acc7ff Mon Sep 17 00:00:00 2001 From: MohamedAmineDerouiche Date: Wed, 4 Nov 2020 19:53:57 +0100 Subject: [PATCH 2/2] refactored --- script.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/script.py b/script.py index f071de9..b4bbcf6 100644 --- a/script.py +++ b/script.py @@ -25,11 +25,9 @@ ######### # INSERT YOUR CODE BELOW THIS LINE -results=[] + for x in range(2000, 3201): if (x%7==0) and (x%5!=0): - results.append(str(x)) - -print ','.join(results) +print(x) #########