Just a simple question for one concerned with memory. Does it matter in either case which I choose to check if a value is between two numbers?

+2 votes

Assuming `if x in range(y,z)`

works the way i expect it to work I believe the latter will be more efficient, as for you to possibly check if an item is in an array you have to loop through it(assuming the program doesn't recognize that the array is defined easily with a mathematical function), so checking for bounds is better as `if x >= y and x < z`

rather than `if x in range(y,z)`

- All categories
- Engine 26,653