diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2024-06-11 21:53:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-11 21:53:20 +0100 |
| commit | f0c126f3a008f589b2dfb39ed231bd1e8abafb0a (patch) | |
| tree | b854398ce8f4eadb761cef52dab750250ad2aac8 | |
| parent | 9ef842e7e7d8cfe407f22fa985dad2455ab3c227 (diff) | |
| parent | 960c288244dbd2d9c9922503b55acfb5712eff36 (diff) | |
| download | perlweeklychallenge-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.raku | 24 | ||||
| -rw-r--r-- | challenge-273/ash/raku/ch-2.raku | 15 |
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 /); +} |
