aboutsummaryrefslogtreecommitdiff
path: root/challenge-009/zapwai/python/ch-1.py
diff options
context:
space:
mode:
authorDavid Ferrone <zapwai@gmail.com>2024-03-15 11:21:15 -0400
committerDavid Ferrone <zapwai@gmail.com>2024-03-15 11:21:15 -0400
commit60c68b3209b3c09d3cbd29b4ef33080546a43fbd (patch)
tree48d43fa4f9c8ea2492e7ab11146b7df7bb1a1679 /challenge-009/zapwai/python/ch-1.py
parent2a68a16c1d8727b183d85c88f31ae6cec6a869b1 (diff)
downloadperlweeklychallenge-club-60c68b3209b3c09d3cbd29b4ef33080546a43fbd.tar.gz
perlweeklychallenge-club-60c68b3209b3c09d3cbd29b4ef33080546a43fbd.tar.bz2
perlweeklychallenge-club-60c68b3209b3c09d3cbd29b4ef33080546a43fbd.zip
Weekly Challenge Blast from the Past
Diffstat (limited to 'challenge-009/zapwai/python/ch-1.py')
-rw-r--r--challenge-009/zapwai/python/ch-1.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-009/zapwai/python/ch-1.py b/challenge-009/zapwai/python/ch-1.py
new file mode 100644
index 0000000000..7b7ab0247e
--- /dev/null
+++ b/challenge-009/zapwai/python/ch-1.py
@@ -0,0 +1,18 @@
+def has_distinct_digits(num):
+ h = []
+ h.append( num % 10 )
+ num_length = len(str(num))
+ while num > 0:
+ num = num // 10
+ h.append( num % 10 )
+ h.pop()
+ uniq = set(h)
+ return len(uniq) == num_length;
+
+def proc():
+ for i in range(150):
+ if len(str(i*i)) >= 5 and has_distinct_digits(i*i):
+ print(i,"has the square:",i*i)
+ break;
+
+proc()