diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-01-05 20:32:18 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-01-05 20:32:18 +0000 |
| commit | a3955b58c74d643c9cbff8fe2b43e4befb1f32ba (patch) | |
| tree | 464a1f34687eda78818caad752e555570a1914c1 /challenge-198/eric-cheung/python/ch-1.py | |
| parent | 744d48aaf56cf5749fee4b79970567b191370a11 (diff) | |
| download | perlweeklychallenge-club-a3955b58c74d643c9cbff8fe2b43e4befb1f32ba.tar.gz perlweeklychallenge-club-a3955b58c74d643c9cbff8fe2b43e4befb1f32ba.tar.bz2 perlweeklychallenge-club-a3955b58c74d643c9cbff8fe2b43e4befb1f32ba.zip | |
- Added solutions by Arne Sommer.
- Added blog post by James Smith.
- Added solutions by Bob Lied.
- Added solutions by Dave Jacoby.
- Added solutions by E. Choroba.
- Added solutions by Ali Moradi.
- Added solutions by Marton Polgar.
- Added solutions by Luca Ferrari.
- Added solutions by Pip Stuart.
- Added solutions by Peter Campbell Smith.
- Added solutions by Robbie Hatley.
- Added solutions by Stephen G. Lynn.
- Added solutions by Rawley Fowler.
Diffstat (limited to 'challenge-198/eric-cheung/python/ch-1.py')
| -rwxr-xr-x | challenge-198/eric-cheung/python/ch-1.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/challenge-198/eric-cheung/python/ch-1.py b/challenge-198/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..34d0347180 --- /dev/null +++ b/challenge-198/eric-cheung/python/ch-1.py @@ -0,0 +1,12 @@ +
+arrInputList = [2, 5, 8, 1] ## Example 1
+## arrInputList = [3] ## Example 2
+
+arrInputList.sort()
+arrDiff = [arrInputList[nIndx + 1] - arrInputList[nIndx] for nIndx in range(0, len(arrInputList) - 1)]
+
+if len(arrDiff) > 0:
+ nMaxArrDiff = max(arrDiff)
+ print (arrDiff.count(nMaxArrDiff))
+else:
+ print (0)
|
