Boolean operation in if : Boolean « Data Type « Python






Boolean operation in if

Boolean operation in if

# number <= 10 and number >= 1 could be written as 1 <= number <= 10

number = 9

if number <= 10 and number >= 1:
    print 'Great!'
else:
    print 'Wrong!'

           
       








Related examples in the same category

1.In Python any non-zero integer value is true; zero is false.In Python any non-zero integer value is true; zero is false.
2.Anything with a non-zero length is true, empty sequences are falseAnything with a non-zero length is true, empty sequences are false