Question
Complete the get_index_of_smallest function which is passed a list of integer numbers as a parameter. The function returns the index of the smallest element in the list. If two or more numbers in the list have the same value as the smallest number, the function should return the first number from the start of the list which has the smallest value The function should return -1 if the list is an empty list. For example Test Result list1 [23, 3, 6, 5, 12, 9, 7, 4 1 print(get_index_of_smallest(list1)) [23, 3, 6, 5, 12, 9, 7, 4] print(list1) Answer (penalty regime: 0 %) 1 Idef get_index_of_smallest (numbers): Check
Explanation / Answer
def get_index_of_smallest(numbers): if len(numbers) == 0: return -1 else: ind = 0 for i in range(len(numbers)): if numbers[i]