Next highest int from digits: Difference between revisions

m
→‎Python: Algorithm 2: Remove dev. printout.
m (em.)
m (→‎Python: Algorithm 2: Remove dev. printout.)
Line 61:
<lang python>def closest_more_than(n, lst):
"(index of) closest int from lst, to n that is also > n"
#print('closest_more_than2' + str((n, lst)))
large = max(lst) + 1
return lst.index(min(lst, key=lambda x: (large if x <= n else x)))
Anonymous user