diff options
Diffstat (limited to 'content/posts/2018/2018-09-13-hackerrank-solutions-python3-and-perl6-part-1.md')
-rw-r--r-- | content/posts/2018/2018-09-13-hackerrank-solutions-python3-and-perl6-part-1.md | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/content/posts/2018/2018-09-13-hackerrank-solutions-python3-and-perl6-part-1.md b/content/posts/2018/2018-09-13-hackerrank-solutions-python3-and-perl6-part-1.md index c7418e7..c3f2aee 100644 --- a/content/posts/2018/2018-09-13-hackerrank-solutions-python3-and-perl6-part-1.md +++ b/content/posts/2018/2018-09-13-hackerrank-solutions-python3-and-perl6-part-1.md @@ -19,13 +19,13 @@ I will show solutions to some challenges to show the differences. I hope that I can show that Perl doesn't have to be the "write only" language that many people make it out to be. -{< admonition title="note" >} +{{< admonition title="note" >}} I am _much_ more proficient in the Perl 6 programming language than in Python (2 or 3), so I might not always use the most optimal solutions in the Python variants. Suggestions are welcome via email, though I most likely won't update this post with better solutions. I ofcourse also welcome feedback on the Perl 6 solutions! -{< / admonition >} +{{< / admonition >}} ## Challenges @@ -102,11 +102,11 @@ sub simple-array-sum (@ar) { } ``` -{< admonition title="note" >} +{{< admonition title="note" >}} After publishing this post I have learned that both Python 3 and Perl 6 have a `.sum` function that can also be called on the array, simplifying the code in both languages. -{< / admonition >} +{{< / admonition >}} ### Compare the Triplets @@ -153,10 +153,10 @@ Both of these loops could use a `continue` (or `next` in Perl 6) to skip the second `if` in case the first `if` was true, but for readability I chose not to. -{< admonition title="note" >} +{{< admonition title="note" >}} After publishing this post I learned that Python 3 also supports the inline if syntax, just like Perl 6, so I could've used this in Python 3 as well. -{< / admonition >} +{{< / admonition >}} ### A Very Big Sum @@ -368,11 +368,11 @@ sub birthday-cake-candles (@ar) { } ``` -{< admonition title="note" >} +{{< admonition title="note" >}} On IRC, someone showed me a clean solution in Python 3: `return ar.count(max(ar))`. This feels like a much cleaner solution than what I had created. -{< / admonition >} +{{< / admonition >}} ### Time Conversion |