diff options
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)
+
+
+
+
+
|
