aboutsummaryrefslogtreecommitdiff
path: root/challenge-239/augiedb/python
diff options
context:
space:
mode:
authorAugie De Blieck Jr <augiedb@gmail.com>2023-10-22 22:04:52 -0400
committerAugie De Blieck Jr <augiedb@gmail.com>2023-10-22 22:04:52 -0400
commit2ef9e488dd892b37b2bda89f61c75fb2ea20985f (patch)
treee1c42586140520c5b897e9bdc61962be82785683 /challenge-239/augiedb/python
parent1407a3e91e6978a6b6d7685bc138c9e817dc6401 (diff)
downloadperlweeklychallenge-club-2ef9e488dd892b37b2bda89f61c75fb2ea20985f.tar.gz
perlweeklychallenge-club-2ef9e488dd892b37b2bda89f61c75fb2ea20985f.tar.bz2
perlweeklychallenge-club-2ef9e488dd892b37b2bda89f61c75fb2ea20985f.zip
Challenge entry from Augie De Blieck Jr.
Diffstat (limited to 'challenge-239/augiedb/python')
-rw-r--r--challenge-239/augiedb/python/ch-1.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/challenge-239/augiedb/python/ch-1.py b/challenge-239/augiedb/python/ch-1.py
new file mode 100644
index 0000000000..e8eb02e859
--- /dev/null
+++ b/challenge-239/augiedb/python/ch-1.py
@@ -0,0 +1,28 @@
+from functools import reduce
+
+def show_inputs(arr1, arr2):
+ print( "Input: @arr1 = ", arr1 )
+ print( " @arr2 = ", arr2 )
+
+def reduce_string(arr):
+ return reduce(lambda x, y: x + y, arr)
+
+def compare_strings(str1, str2):
+ return "true" if str1 == str2 else "false"
+
+def show_output(final_answer):
+ print( "Output: ", final_answer, "\n" )
+
+def run_everything(arr1, arr2):
+ show_inputs(arr1, arr2)
+ str1 = reduce_string(arr1)
+ str2 = reduce_string(arr2)
+ show_output( compare_strings(str1, str2) )
+
+## Run process with example data
+run_everything(["ab", "c"], ["a", "bc"] )
+run_everything(["ab", "c"], ["ac", "b"] )
+run_everything(["ab", "cd", "e"], ["abcde"] )
+
+
+