aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2024-06-11 21:53:20 +0100
committerGitHub <noreply@github.com>2024-06-11 21:53:20 +0100
commitf0c126f3a008f589b2dfb39ed231bd1e8abafb0a (patch)
treeb854398ce8f4eadb761cef52dab750250ad2aac8
parent9ef842e7e7d8cfe407f22fa985dad2455ab3c227 (diff)
parent960c288244dbd2d9c9922503b55acfb5712eff36 (diff)
downloadperlweeklychallenge-club-f0c126f3a008f589b2dfb39ed231bd1e8abafb0a.tar.gz
perlweeklychallenge-club-f0c126f3a008f589b2dfb39ed231bd1e8abafb0a.tar.bz2
perlweeklychallenge-club-f0c126f3a008f589b2dfb39ed231bd1e8abafb0a.zip
Merge pull request #10251 from ash/master
Week 273, solutions in Raku by ash
-rw-r--r--challenge-273/ash/raku/ch-1.raku24
-rw-r--r--challenge-273/ash/raku/ch-2.raku15
2 files changed, 39 insertions, 0 deletions
diff --git a/challenge-273/ash/raku/ch-1.raku b/challenge-273/ash/raku/ch-1.raku
new file mode 100644
index 0000000000..77ddcdd186
--- /dev/null
+++ b/challenge-273/ash/raku/ch-1.raku
@@ -0,0 +1,24 @@
+# Solution to the Task 1 of the Weekly Challenge 273
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-273/#TASK1
+
+# Test run:
+# $ raku ch-1.raku
+# 25
+# 50
+# 0
+# 67
+# 22
+# 13
+
+my @tests =
+ perl => 'e',
+ java => 'a',
+ python => 'm',
+ ada => 'a',
+ ballerina => 'l',
+ analitik => 'k';
+
+for @tests -> $pair {
+ say (100 * $pair.key.comb($pair.value) / $pair.key.comb).round;
+ # say (100 * $pair.key.comb($pair.value).elems / $pair.key.comb.elems).round;
+}
diff --git a/challenge-273/ash/raku/ch-2.raku b/challenge-273/ash/raku/ch-2.raku
new file mode 100644
index 0000000000..fc35c23e6c
--- /dev/null
+++ b/challenge-273/ash/raku/ch-2.raku
@@ -0,0 +1,15 @@
+# Solution to the Task 2 of the Weekly Challenge 273
+# https://theweeklychallenge.org/blog/perl-weekly-challenge-273/#TASK2
+
+# Test run:
+# $ raku ch-2.raku
+# true
+# false
+# false
+# true
+
+my @tests = < aabb abab aaa bbb >;
+
+for @tests -> $test {
+ say lc ?($test ~~ / bb /);
+}