mardi 8 décembre 2015

Python: if condition change value to the nearest value [duplicate]

Probably that is easy, but I cannot figure it out.

I have a list (not a Python list, because I don't know the end of the list) with the following values: [20, 220, 420, 620, 820, ...] and I have one number, for instance 724.

I want to return the nearest lower value from this "list", in this case 620.

How can this be achieved?

Aucun commentaire:

Enregistrer un commentaire