0

# How do you get the smallest integer in a list without using the min() built-in function and also its index?

5 Answers

+ 9

Use a for loop to go through each element. Test if it is less than a variable "min." If it is, replace "min" with that number and continue until you have gone through all of the elements.

+ 4

what J.G. said

+ 3

for loop with "enumerate" function will help you get both min value and its index at the same time.

0

nums = [23,18,45,2,9]
x = sorted(nums)[0]
print(x,nums.index(x))

- 2

Implement a sort algorithm (quick sort, bubble sort, binary sort)