From cf1dca4f9f1a502177caf0a1e8551d43d0ae0236 Mon Sep 17 00:00:00 2001 From: Iulian Gulea Date: Sun, 9 Jun 2019 17:27:41 +0300 Subject: [PATCH] Add a shorter way to find the indexes of min and max elements of a list. --- minmaxindex.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/minmaxindex.py b/minmaxindex.py index ff9e146..98bbdba 100644 --- a/minmaxindex.py +++ b/minmaxindex.py @@ -14,3 +14,7 @@ def maxIndex(lst): print(minIndex(lst)) print(maxIndex(lst)) + +# using `index` method on a list object +lst.index(min(lst)) +lst.index(max(lst))