From b60cb77fe463f9c97a8170868a2ff874554d5f41 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Tue, 28 Nov 2023 11:53:44 +0000 Subject: - Added solutions by PokGoPun. - Added solutions by Luca Ferrari. - Added solutions by Humberto Massa. - Added solutions by Niels van Dijke. - Added solutions by Peter Campbell Smith. - Added solutions by Dave Jacoby. - Added solutions by Thomas Kohler. - Added solutions by Peter Meszaros. - Added solutions by E. Choroba. - Added solutions by David Ferrone. - Added solutions by W. Luis Mochan. - Added solutions by Mariano Spadaccini. --- challenge-245/eric-cheung/python/ch-1.py | 12 ++++++++++++ challenge-245/eric-cheung/python/ch-2.py | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100755 challenge-245/eric-cheung/python/ch-1.py create mode 100755 challenge-245/eric-cheung/python/ch-2.py (limited to 'challenge-245/eric-cheung/python') diff --git a/challenge-245/eric-cheung/python/ch-1.py b/challenge-245/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..35addf394d --- /dev/null +++ b/challenge-245/eric-cheung/python/ch-1.py @@ -0,0 +1,12 @@ + +## Example 1 +## arrLang = ["perl", "c", "python"] +## arrPopularity = [2, 1, 3] + +## Example 2 +arrLang = ["c++", "haskell", "java"] +arrPopularity = [1, 3, 2] + +arrOutput = [arrLangLoop for arrPopularityLoop, arrLangLoop in sorted(zip(arrPopularity, arrLang))] + +print (arrOutput) diff --git a/challenge-245/eric-cheung/python/ch-2.py b/challenge-245/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..9f531e288b --- /dev/null +++ b/challenge-245/eric-cheung/python/ch-2.py @@ -0,0 +1,8 @@ + +## arrDigits = [8, 1, 9] ## Example 1 +arrDigits = [8, 6, 7, 1, 0] ## Example 2 + +if sum(arrDigits) % 3 == 0: + print ("".join(sorted([str(DigitLoop) for DigitLoop in arrDigits], reverse = True))) +else: + print (-1) -- cgit