aboutsummaryrefslogtreecommitdiff
path: root/challenge-150/abigail/python/ch-2.py
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2022-02-02 10:09:18 +0000
committerGitHub <noreply@github.com>2022-02-02 10:09:18 +0000
commitfa94229fcb2321c0b2aef98d19dfd3fee18a5699 (patch)
tree5cc20d2538e335d9e9a5320f0ee112aae2fe5d87 /challenge-150/abigail/python/ch-2.py
parent1594215dac459eef085ceadcf8ffe2e7280ffecb (diff)
parentd007a9c8216764b0ed11bbae7179481f8ad5b1a0 (diff)
downloadperlweeklychallenge-club-fa94229fcb2321c0b2aef98d19dfd3fee18a5699.tar.gz
perlweeklychallenge-club-fa94229fcb2321c0b2aef98d19dfd3fee18a5699.tar.bz2
perlweeklychallenge-club-fa94229fcb2321c0b2aef98d19dfd3fee18a5699.zip
Merge pull request #5599 from Abigail/abigail/week-150
Abigail/week 150
Diffstat (limited to 'challenge-150/abigail/python/ch-2.py')
-rw-r--r--challenge-150/abigail/python/ch-2.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/challenge-150/abigail/python/ch-2.py b/challenge-150/abigail/python/ch-2.py
new file mode 100644
index 0000000000..c1fd1e5447
--- /dev/null
+++ b/challenge-150/abigail/python/ch-2.py
@@ -0,0 +1,22 @@
+#!/usr/local/bin/python3
+
+#
+# See https://theweeklychallenge.org/blog/perl-weekly-challenge-150
+#
+
+#
+# Run as: python ch-2.py
+#
+
+import sys
+
+primes = [2, 3, 5, 7, 11, 13, 17, 19]
+
+for n in range (1, 501):
+ has_square = False
+ for p in primes:
+ if n % (p * p) == 0:
+ has_square = True
+ if not has_square:
+ sys . stdout . write (str (n) + " ")
+sys . stdout . write ("\n")