From ec3eb82c6fbf7b795c2646713b23538127571937 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Tue, 18 Apr 2023 20:20:03 +0100 Subject: - Added solutions by Mark Anderson. - Added solutions by Leo Manfredi. - Added solutions by W. Luis Mochan. - Added solutions by Niels van Dijke. - Added solutions by Luca Ferrari. - Added solutions by Laurent Rosenfeld. - Added solutions by Robert DiCicco. --- challenge-213/eric-cheung/python/ch-1.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 challenge-213/eric-cheung/python/ch-1.py (limited to 'challenge-213/eric-cheung/python/ch-1.py') diff --git a/challenge-213/eric-cheung/python/ch-1.py b/challenge-213/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..84012d3bd2 --- /dev/null +++ b/challenge-213/eric-cheung/python/ch-1.py @@ -0,0 +1,21 @@ + +## arrListInput = [1, 2, 3, 4, 5, 6] ## Example 1 +## arrListInput = [1, 2] ## Example 2 +arrListInput = [1] ## Example 3 + +arrListOutput = [] + +if len(arrListInput) > 1: + arrListInput.sort() + + for nElem in arrListInput: + if nElem % 2 == 0: + arrListOutput.append(nElem) + + for nElem in arrListInput: + if nElem % 2 == 1: + arrListOutput.append(nElem) +else: + arrListOutput = arrListInput + +print (arrListOutput) -- cgit