Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

[python] index of absolute maximum value in a list

$
0
0

@ivelin.peychev wrote:

I know how to get the index of the maximum value in a list.

mylist = [-10,0,1]
idx_max_value = max(xrange(len(mylist)), key=mylist.__getitem__)
#>>> 2

However, I need it to take the abs(-10) and so the result will be 0.

How can I do that?

Thanks in advance.

Posts: 6

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles