finding range a number is in python code example
Example 1: Write a Python function to check whether a number is in a given range.
def test_range(n):
if n in range(3,9):
print( " %s is in the range"%str(n))
else :
print("The number is outside the given range.")
test_range(5)
Example 2: find the range in python
def find_range(n):
lowest = min(n)
highest = max(n)
# Find the range
r = highest - lowest
return lowest, highest, r
# src : Doing Math With Python