+ 2

How can i get the position of the smallest number in the list in python?

for example:[6,8,9,1,4] i want show 3(position of the number 1 in the list)

23rd Feb 2018, 9:29 AM
mohamadjavad
mohamadjavad - avatar
2 Antworten
+ 4
## if only one min element lst1=[6, 8, 9, 1, 4] minNum=min(lst1) indexOfMinNum=lst1.index(minNum) print (indexOfMinNum) ## if multiple min element lst2=[6,1,8,1,1,9] minNum=min(lst1) print([i for i in range (len(lst2)) if lst2[i]==minNum])
23rd Feb 2018, 9:48 AM
sayan chandra
sayan chandra - avatar
+ 1
thanks❤️
23rd Feb 2018, 9:44 AM
mohamadjavad
mohamadjavad - avatar