aboutsummaryrefslogtreecommitdiff
path: root/challenge-279/deadmarshal/python
diff options
context:
space:
mode:
authorSantiago Leyva <99155189+DevSanti12@users.noreply.github.com>2024-07-25 23:57:49 -0500
committerGitHub <noreply@github.com>2024-07-25 23:57:49 -0500
commitdb40d75f603f3fae34944cb3a762b290b18577d8 (patch)
tree1205c733ae416bcbce12e225a5252841316c5540 /challenge-279/deadmarshal/python
parent350f495b09a4b6b6db8506533e2dccc68d9fc3f4 (diff)
parent3d6cbce024396f3950dad9b40151458e4134202d (diff)
downloadperlweeklychallenge-club-db40d75f603f3fae34944cb3a762b290b18577d8.tar.gz
perlweeklychallenge-club-db40d75f603f3fae34944cb3a762b290b18577d8.tar.bz2
perlweeklychallenge-club-db40d75f603f3fae34944cb3a762b290b18577d8.zip
Merge branch 'manwar:master' into master
Diffstat (limited to 'challenge-279/deadmarshal/python')
-rw-r--r--challenge-279/deadmarshal/python/ch1.py10
-rw-r--r--challenge-279/deadmarshal/python/ch2.py10
2 files changed, 20 insertions, 0 deletions
diff --git a/challenge-279/deadmarshal/python/ch1.py b/challenge-279/deadmarshal/python/ch1.py
new file mode 100644
index 0000000000..f1125f2bcb
--- /dev/null
+++ b/challenge-279/deadmarshal/python/ch1.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+
+def sort_letters(letters,weights):
+ d = dict(zip(letters,weights))
+ return ''.join(sorted(d.keys(),key=lambda k: d[k]))
+
+print(sort_letters(['R','E','P','L'],[3,2,1,4]))
+print(sort_letters(['A','U','R','K'],[2,4,1,3]))
+print(sort_letters(['O','H','Y','N','P','T'],[5,4,2,6,1,3]))
+
diff --git a/challenge-279/deadmarshal/python/ch2.py b/challenge-279/deadmarshal/python/ch2.py
new file mode 100644
index 0000000000..915438046e
--- /dev/null
+++ b/challenge-279/deadmarshal/python/ch2.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+
+def split_string(s):
+ vowels = 'aeiouAEIOU'
+ return sum(s.count(v) for v in vowels) % 2 == 0
+
+print(split_string('perl'))
+print(split_string('book'))
+print(split_string('good morning'))
+