From 479ca4e9c71aa2ea5be2bc7b66451c21be9d8dde Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 6 May 2024 11:19:31 +0100 Subject: - Added solutions by Eric Cheung. - Added solutions by Mark Anderson. - Added solutions by Feng Chang. - Added solutions by PokGoPun. --- challenge-268/eric-cheung/python/ch-2.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 challenge-268/eric-cheung/python/ch-2.py (limited to 'challenge-268/eric-cheung/python/ch-2.py') diff --git a/challenge-268/eric-cheung/python/ch-2.py b/challenge-268/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..de091f76fe --- /dev/null +++ b/challenge-268/eric-cheung/python/ch-2.py @@ -0,0 +1,15 @@ + +## arrInt = [2, 5, 3, 4] ## Example 1 +## arrInt = [9, 4, 1, 3, 6, 4, 6, 1] ## Example 2 +arrInt = [1, 2, 2, 3] ## Example 3 + +arrInt = sorted(arrInt) +arrOutput = [] + +while len(arrInt) > 0: + arrOutput.append(arrInt[1]) + arrOutput.append(arrInt[0]) + del arrInt[1] + del arrInt[0] + +print (arrOutput) -- cgit