number = float(input('Enter your number: '))
# Check if the entered number is in the range (0,10) inclusive
# example of a nested conditional operator
if number <= 10:
    if number >= 0:
        print('The entered number is in the range (0,10) inclusive') 
    else:
        print('The entered number is not in the range (0,10)')
else:
    print('The entered number is not in the range (0,10)')
# an example of an equivalent single conditional statement
if 0 <= number <= 10:
    print('The entered number is in the range (0,10) inclusive')
else:
    print('The entered number is not in the range (0,10)')
Comments