From fc8013d400fee6ab06de6dc4da285d877b3eb555 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Tue, 2 May 2023 17:08:02 +0100 Subject: - Added solutions by Robert DiCicco. --- challenge-215/eric-cheung/python/ch-1.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 challenge-215/eric-cheung/python/ch-1.py (limited to 'challenge-215/eric-cheung/python/ch-1.py') diff --git a/challenge-215/eric-cheung/python/ch-1.py b/challenge-215/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..1398ab8a04 --- /dev/null +++ b/challenge-215/eric-cheung/python/ch-1.py @@ -0,0 +1,16 @@ + +## arrWordInput = ['abc', 'xyz', 'tsu'] ## Example 1 +## arrWordInput = ['rat', 'cab', 'dad'] ## Example 2 +arrWordInput = ['x', 'y', 'z'] ## Example 3 + +arrRemovedWord = [] + +for strWordLoop in arrWordInput: + + strSortWordLoop = ''.join(sorted(strWordLoop)) + if strWordLoop == strSortWordLoop: + continue + + arrRemovedWord.append(strWordLoop) + +print (len(arrRemovedWord)) -- cgit