dimanche 12 septembre 2021

How do I find which of 2 values are closer to a given number in python?

I have 2 variables, value1 and value2. I want to see which of these values are closer to the number 21 through an if statement. So in pseudocode,

If value1 is closer to 21:
    Event1
elif value2 is closer to 21:
    Event2
else:
    Event3

Any help would be appreciated thanks!

Aucun commentaire:

Enregistrer un commentaire