From b7c6ba230d95ffad246f0f9874e82cbd95e12f56 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Tue, 1 Aug 2023 00:30:26 +0100 Subject: - Added solutions by Niels van Dijke. - Added solutions by Ulrich Rieke. - Added solutions by Robert DiCicco. - Added solutions by Laurent Rosenfeld. - Added solutions by Peter Meszaros. - Added solutions by Mark Anderson. - Added solutions by Lubos Kolouch. - Added solutions by Ali Moradi. - Added solutions by Dave Jacoby. - Added solutions by Peter Campbell Smith. - Added solutions by W. Luis Mochan. - Added solutions by Steven Wilson. - Added solutions by Thomas Kohler. - Added solutions by E. Choroba. - Added solutions by Bob Lied. --- challenge-228/eric-cheung/python/ch-1.py | 8 ++++++++ challenge-228/eric-cheung/python/ch-2.py | 13 +++++++++++++ 2 files changed, 21 insertions(+) create mode 100755 challenge-228/eric-cheung/python/ch-1.py create mode 100755 challenge-228/eric-cheung/python/ch-2.py (limited to 'challenge-228/eric-cheung/python') diff --git a/challenge-228/eric-cheung/python/ch-1.py b/challenge-228/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..ae4d0ec1d9 --- /dev/null +++ b/challenge-228/eric-cheung/python/ch-1.py @@ -0,0 +1,8 @@ + +## arrInt = [2, 1, 3, 2] ## Example 1 +## arrInt = [1, 1, 1, 1] ## Example 2 +arrInt = [2, 1, 3, 4] ## Example 3 + +arrUniqInt = [nLoop for nLoop in list(set(arrInt)) if arrInt.count(nLoop) == 1] + +print (sum(arrUniqInt)) diff --git a/challenge-228/eric-cheung/python/ch-2.py b/challenge-228/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..6f74b418c1 --- /dev/null +++ b/challenge-228/eric-cheung/python/ch-2.py @@ -0,0 +1,13 @@ + +## arrInt = [3, 4, 2] ## Example 1 +arrInt = [1, 2, 3] ## Example 2 + +nCount = 0 + +while len(arrInt) > 0: + if arrInt[0] > min(arrInt): + arrInt.append(arrInt[0]) + del arrInt[0] + nCount = nCount + 1 + +print (nCount) -- cgit