aboutsummaryrefslogtreecommitdiff
path: root/challenge-326/eric-cheung/python
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <mohammad.anwar@yahoo.com>2025-06-16 22:04:21 +0100
committerMohammad Sajid Anwar <mohammad.anwar@yahoo.com>2025-06-16 22:04:21 +0100
commit93412c7fa19e013c244e41e417def795f7aac313 (patch)
treedbe6dd06c816981ffaa65c7ecf18568de4eb8c64 /challenge-326/eric-cheung/python
parentda274437fe0c9f4c0cf45d83bda88e096bfb3763 (diff)
downloadperlweeklychallenge-club-93412c7fa19e013c244e41e417def795f7aac313.tar.gz
perlweeklychallenge-club-93412c7fa19e013c244e41e417def795f7aac313.tar.bz2
perlweeklychallenge-club-93412c7fa19e013c244e41e417def795f7aac313.zip
- Added solutions by Eric Cheung.
- Added solutions by Ulrich Rieke. - Added solutions by Feng Chang. - Added solutions by Mark Anderson. - Added solutions by Andrew Shitov. - Added solutions by Niels van Dijke. - Added solutions by E. Choroba. - Added solutions by PokGoPun. - Added solutions by Ali Moradi. - Added solutions by Andreas Mahnke. - Added solutions by Peter Meszaros. - Added solutions by David Ferrone. - Added solutions by W. Luis Mochan. - Added solutions by Thomas Kohler.
Diffstat (limited to 'challenge-326/eric-cheung/python')
-rwxr-xr-xchallenge-326/eric-cheung/python/ch-1.py10
-rwxr-xr-xchallenge-326/eric-cheung/python/ch-2.py11
2 files changed, 21 insertions, 0 deletions
diff --git a/challenge-326/eric-cheung/python/ch-1.py b/challenge-326/eric-cheung/python/ch-1.py
new file mode 100755
index 0000000000..e9b004ffaa
--- /dev/null
+++ b/challenge-326/eric-cheung/python/ch-1.py
@@ -0,0 +1,10 @@
+
+from datetime import datetime
+
+## strDate = "2025-02-02" ## Example 1
+## strDate = "2025-04-10" ## Example 2
+strDate = "2025-09-07" ## Example 3
+
+objDate = datetime.strptime(strDate, "%Y-%m-%d").timetuple()
+
+print (objDate.tm_yday)
diff --git a/challenge-326/eric-cheung/python/ch-2.py b/challenge-326/eric-cheung/python/ch-2.py
new file mode 100755
index 0000000000..347f9d2014
--- /dev/null
+++ b/challenge-326/eric-cheung/python/ch-2.py
@@ -0,0 +1,11 @@
+
+## arrInt = [1, 3, 2, 4] ## Example 1
+## arrInt = [1, 1, 2, 2] ## Example 2
+arrInt = [3, 1, 3, 2] ## Example 3
+
+arrOutput = []
+
+for nIndx in range(1, len(arrInt), 2):
+ arrOutput = arrOutput + [arrInt[nIndx]] * arrInt[nIndx - 1]
+
+print (arrOutput)