diff options
| author | Dave Jacoby <jacoby.david@gmail.com> | 2025-05-15 16:45:20 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-15 16:45:20 -0400 |
| commit | efc2a652edb6436965e12883bedf035ea081284d (patch) | |
| tree | 7e9940d4f72fe1e8d984b3746af2d30dff96330b /challenge-321/eric-cheung/python/ch-1.py | |
| parent | 6886bd3e06ccf8b0a564f3c434cd53131d126f70 (diff) | |
| parent | ed7588dadb77d63adca3d3aefc6cd325164e0947 (diff) | |
| download | perlweeklychallenge-club-efc2a652edb6436965e12883bedf035ea081284d.tar.gz perlweeklychallenge-club-efc2a652edb6436965e12883bedf035ea081284d.tar.bz2 perlweeklychallenge-club-efc2a652edb6436965e12883bedf035ea081284d.zip | |
Merge branch 'manwar:master' into master
Diffstat (limited to 'challenge-321/eric-cheung/python/ch-1.py')
| -rwxr-xr-x | challenge-321/eric-cheung/python/ch-1.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-321/eric-cheung/python/ch-1.py b/challenge-321/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..6bd299ac82 --- /dev/null +++ b/challenge-321/eric-cheung/python/ch-1.py @@ -0,0 +1,19 @@ +
+## arrNums = [1, 2, 4, 3, 5, 6] ## Example 1
+## arrNums = [0, 2, 4, 8, 3, 5] ## Example 2
+arrNums = [7, 3, 1, 0, 5, 9] ## Example 3
+
+arrNums = sorted(arrNums)
+
+arrAvg = []
+
+while len(arrNums) > 0:
+ nMax = arrNums[-1]
+ nMin = arrNums[0]
+
+ arrAvg.append((nMax + nMin) / 2)
+
+ arrNums.pop(-1)
+ arrNums.pop(0)
+
+print (len(set(arrAvg)))
|
