I would like to write a function that takes integer numbers x, y, L and R as parameters and returns True if x**y lies in the interval (L, R] and False otherwise.
I am considering several ways to write a conditional statement inside this function:
if L < x ** y <= R:if x ** y > L and x ** y <= R:if x ** y in range(L + 1, R + 1):
Why is option 1 the most efficient in terms of execution time ?
Aucun commentaire:
Enregistrer un commentaire