As the code below, I know how to get the item that maximize a function from a list, but I also want to get the maximized value together with the item. In reality I have a very computationally expensive function so I don't want to run the function again. Here I just use a sigmoid function as an example.
import math
lst = list(range(100))
maxnum = max(lst, key=lambda x: 1 / (1 + math.exp(-x)))
maxval = 1 / (1 + math.exp(-maxnum))
print(maxnum, maxval)