aboutsummaryrefslogtreecommitdiff
path: root/challenge-260/eric-cheung/python/ch-2.py
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2024-03-11 11:24:14 +0000
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2024-03-11 11:24:14 +0000
commit77245595e193396bdb9347f5b5de7a088aea8bae (patch)
tree1e0b98bc1c373281c250c8ea8e340ab33fcca358 /challenge-260/eric-cheung/python/ch-2.py
parentb555f7d86b4cc0f38c935a7284549fa0feae24a7 (diff)
downloadperlweeklychallenge-club-77245595e193396bdb9347f5b5de7a088aea8bae.tar.gz
perlweeklychallenge-club-77245595e193396bdb9347f5b5de7a088aea8bae.tar.bz2
perlweeklychallenge-club-77245595e193396bdb9347f5b5de7a088aea8bae.zip
- Added solutions by Eric Cheung.
- Added solutions by Mark Anderson. - Added solutions by W. Luis Mochan. - Added solutions by E.Choroba.
Diffstat (limited to 'challenge-260/eric-cheung/python/ch-2.py')
-rwxr-xr-xchallenge-260/eric-cheung/python/ch-2.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/challenge-260/eric-cheung/python/ch-2.py b/challenge-260/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..17f5aa4003
--- /dev/null
+++ b/challenge-260/eric-cheung/python/ch-2.py
@@ -0,0 +1,12 @@
+
+from itertools import permutations
+
+strWord = "CAT" ## Example 1
+## strWord = "GOOGLE" ## Example 2
+## strWord = "SECRET" ## Example 3
+
+arrPermList = permutations(list(strWord))
+
+arrPermStrList = sorted(list(set(["".join(arrLoop) for arrLoop in list(arrPermList)])))
+
+print (arrPermStrList.index(strWord) + 1)