index of minimum value python
xxxxxxxxxx
# 1. Using the index method:
my_list = [5, 2, 8, 1, 9]
min_index = my_list.index(min(my_list))
print(min_index) # Output: 3
# 2. Using the min function and enumerate:
my_list = [5, 2, 8, 1, 9]
min_index = min(enumerate(my_list), key=lambda x: x[1])[0]
print(min_index) # Output: 3
from chat gpt ¯\_(ツ)_/¯