diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2021-03-28 22:57:30 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2021-03-28 22:57:30 +0100 |
| commit | 4880fd87fd0ed84d7d578ddf5ff0f87d5a6a97cd (patch) | |
| tree | 9d0d3ef78b3eebfd1cab12eb8b07739dcadb228f /challenge-105/colin-crain/python | |
| parent | 358875c6891eb1d1c1c1dc7392a639e352529367 (diff) | |
| download | perlweeklychallenge-club-4880fd87fd0ed84d7d578ddf5ff0f87d5a6a97cd.tar.gz perlweeklychallenge-club-4880fd87fd0ed84d7d578ddf5ff0f87d5a6a97cd.tar.bz2 perlweeklychallenge-club-4880fd87fd0ed84d7d578ddf5ff0f87d5a6a97cd.zip | |
- Added solutions by Colin Crain.
Diffstat (limited to 'challenge-105/colin-crain/python')
| -rw-r--r-- | challenge-105/colin-crain/python/ch-1.py | 20 | ||||
| -rw-r--r-- | challenge-105/colin-crain/python/ch-2.py | 32 |
2 files changed, 52 insertions, 0 deletions
diff --git a/challenge-105/colin-crain/python/ch-1.py b/challenge-105/colin-crain/python/ch-1.py new file mode 100644 index 0000000000..5354ab0f92 --- /dev/null +++ b/challenge-105/colin-crain/python/ch-1.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3
+#
+#
+# nth-root.py
+#
+#
+#
+# © 2021 colin crain
+## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
+
+import math
+
+def nroot( n, x ):
+ return math.exp( math.log(x) / n )
+
+m = 3
+y = 125
+
+print( nroot(m, y) )
+
diff --git a/challenge-105/colin-crain/python/ch-2.py b/challenge-105/colin-crain/python/ch-2.py new file mode 100644 index 0000000000..7e88a72b5e --- /dev/null +++ b/challenge-105/colin-crain/python/ch-2.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3
+#
+#
+# name-game.py
+#
+#
+#
+# © 2021 colin crain
+## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##
+
+
+import re
+import sys
+
+def makeSong( name ):
+ m = re.search("([^aeiouy]?)(.*)", name, re.I)
+ (h, t) = m.group(1,2)
+
+ print(f'''
+ {name}, {name}, bo-{"b" if h != "B" else ""}{t}
+ Bonana-fanna fo-{"f" if h != "F" else ""}{t}
+ Fee fi mo-{"m" if h != "M" else ""}{t}
+ {name}!
+ ''')
+
+for name in sys.argv[1:]:
+ makeSong(name)
+
+
+
+
+
|
