From 4880fd87fd0ed84d7d578ddf5ff0f87d5a6a97cd Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Sun, 28 Mar 2021 22:57:30 +0100 Subject: - Added solutions by Colin Crain. --- challenge-105/colin-crain/python/ch-1.py | 20 ++++++++++++++++++++ challenge-105/colin-crain/python/ch-2.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 challenge-105/colin-crain/python/ch-1.py create mode 100644 challenge-105/colin-crain/python/ch-2.py (limited to 'challenge-105/colin-crain/python') 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) + + + + + -- cgit