aboutsummaryrefslogtreecommitdiff
path: root/challenge-105
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-105')
-rw-r--r--challenge-105/lubos-kolouch/perl/ch-1.pl10
-rw-r--r--challenge-105/lubos-kolouch/perl/ch-2.pl14
-rw-r--r--challenge-105/lubos-kolouch/python/ch-1.pl6
-rw-r--r--challenge-105/lubos-kolouch/python/ch-2.py15
4 files changed, 45 insertions, 0 deletions
diff --git a/challenge-105/lubos-kolouch/perl/ch-1.pl b/challenge-105/lubos-kolouch/perl/ch-1.pl
new file mode 100644
index 0000000000..985223e7ec
--- /dev/null
+++ b/challenge-105/lubos-kolouch/perl/ch-1.pl
@@ -0,0 +1,10 @@
+use strict;
+use warnings;
+
+sub nth_root {
+ my ( $n, $k ) = @_;
+ return sprintf( "%.2f", $k**( 1 / $n ) );
+}
+
+print nth_root( 5, 248832 ); # Output: 12.00
+print nth_root( 5, 34 ); # Output: 2.02
diff --git a/challenge-105/lubos-kolouch/perl/ch-2.pl b/challenge-105/lubos-kolouch/perl/ch-2.pl
new file mode 100644
index 0000000000..2c84eb42de
--- /dev/null
+++ b/challenge-105/lubos-kolouch/perl/ch-2.pl
@@ -0,0 +1,14 @@
+use strict;
+use warnings;
+
+sub name_game {
+ my $name = shift;
+ my $rest_of_name = substr $name, 1;
+ print "$name, $name, bo-b$rest_of_name,\n";
+ print "Bonana-fanna fo-f$rest_of_name\n";
+ print "Fee fi mo-m$rest_of_name\n";
+ print "$name!\n";
+}
+
+name_game('Katie')
+ ; # Output: Katie, Katie, bo-batie, Bonana-fanna fo-fatie, Fee fi mo-matie, Katie!
diff --git a/challenge-105/lubos-kolouch/python/ch-1.pl b/challenge-105/lubos-kolouch/python/ch-1.pl
new file mode 100644
index 0000000000..7dd834b6d4
--- /dev/null
+++ b/challenge-105/lubos-kolouch/python/ch-1.pl
@@ -0,0 +1,6 @@
+def nth_root(n: int, k: float) -> float:
+ return round(k ** (1/n), 2)
+
+print(nth_root(5, 248832)) # Output: 12.0
+print(nth_root(5, 34)) # Output: 2.02
+
diff --git a/challenge-105/lubos-kolouch/python/ch-2.py b/challenge-105/lubos-kolouch/python/ch-2.py
new file mode 100644
index 0000000000..bb4858f939
--- /dev/null
+++ b/challenge-105/lubos-kolouch/python/ch-2.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+def name_game(name: str) -> None:
+ rest_of_name = name[1:]
+ print(f"{name}, {name}, bo-b{rest_of_name},")
+ print(f"Bonana-fanna fo-f{rest_of_name}")
+ print(f"Fee fi mo-m{rest_of_name}")
+ print(f"{name}!")
+
+
+name_game(
+ "Katie"
+) # Output: Katie, Katie, bo-batie, Bonana-fanna fo-fatie, Fee fi mo-matie, Katie!