range_1 = range(2, 40)
number = 11
if number in range_1 :
print(number, 'is present in the range.')
else :
print(number, 'is not present in the range.')
if 10000 <= number <= 30000:
pass
i = 30
if i in range(40):
print("hello world")
import random
l = [20, 40, 60, 80, 100]
y = 88
if y>0 and y<=l[0]:
print("in range 0-20")
for i in range(1,len(l)-1):
if y>l[i] and y<=l[i+1]:
print(i)
#!/bin/bash
while :; do
read -p "Enter a number between 2 and 5: " number
[[ $number =~ ^[0-9]+$ ]] || { echo "Enter a valid number"; continue; }
if ((number >= 2 && number <= 5)); then
echo "valid number"
break
else
echo "number out of range, try again"
fi
done