diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-11-28 11:53:44 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-11-28 11:53:44 +0000 |
| commit | b60cb77fe463f9c97a8170868a2ff874554d5f41 (patch) | |
| tree | 88313e7fe2028c039dfce0ee6afc3344178d2f06 /challenge-245/eric-cheung/python | |
| parent | 70cf619f7168f4b1d5e936cccbd82a26932a1422 (diff) | |
| download | perlweeklychallenge-club-b60cb77fe463f9c97a8170868a2ff874554d5f41.tar.gz perlweeklychallenge-club-b60cb77fe463f9c97a8170868a2ff874554d5f41.tar.bz2 perlweeklychallenge-club-b60cb77fe463f9c97a8170868a2ff874554d5f41.zip | |
- 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.
Diffstat (limited to 'challenge-245/eric-cheung/python')
| -rwxr-xr-x | challenge-245/eric-cheung/python/ch-1.py | 12 | ||||
| -rwxr-xr-x | challenge-245/eric-cheung/python/ch-2.py | 8 |
2 files changed, 20 insertions, 0 deletions
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)
|
