aboutsummaryrefslogtreecommitdiff
path: root/challenge-254/luca-ferrari/python/ch-1.python
diff options
context:
space:
mode:
authorLuca Ferrari <fluca1978@gmail.com>2024-01-29 09:55:32 +0100
committerLuca Ferrari <fluca1978@gmail.com>2024-01-29 11:13:58 +0100
commit7c3628d24263d828b990af5eeac286e3ab7819af (patch)
tree537d3fd7a2bc03b05575cde6fbfd0e96e728ec1b /challenge-254/luca-ferrari/python/ch-1.python
parent4099837cf3689e1d78a66905fde9c5a45ff95940 (diff)
downloadperlweeklychallenge-club-7c3628d24263d828b990af5eeac286e3ab7819af.tar.gz
perlweeklychallenge-club-7c3628d24263d828b990af5eeac286e3ab7819af.tar.bz2
perlweeklychallenge-club-7c3628d24263d828b990af5eeac286e3ab7819af.zip
PWC 254
Task 1 Raku done Task 2 Raku done Task 1 PL/Perl done Task 2 PL/Perl done Task 1 PL/PgSQL done Task 2 PL/PgSQL done Task 1 Python done Task 2 Python done Task 1 PL/Java done Task2 PL/java done
Diffstat (limited to 'challenge-254/luca-ferrari/python/ch-1.python')
-rw-r--r--challenge-254/luca-ferrari/python/ch-1.python26
1 files changed, 26 insertions, 0 deletions
diff --git a/challenge-254/luca-ferrari/python/ch-1.python b/challenge-254/luca-ferrari/python/ch-1.python
new file mode 100644
index 0000000000..a0533551d8
--- /dev/null
+++ b/challenge-254/luca-ferrari/python/ch-1.python
@@ -0,0 +1,26 @@
+#!python
+
+#
+# Perl Weekly Challenge 254
+# Task 1
+#
+# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-254>
+#
+
+import sys
+import math
+
+# task implementation
+# the return value will be printed
+def task_1( args ):
+ num = int( args[ 0 ] )
+ for i in range( 2, int( math.sqrt( num ) ) ):
+ if ( i ** 3 ) == num:
+ return True
+
+ return False
+
+
+# invoke the main without the command itself
+if __name__ == '__main__':
+ print( task_1( sys.argv[ 1: ] ) )