and, or, not (1)
A boolean is either 1
or 0
, True
or False
. With boolean operators such as and
, or
and not
, you can combine these booleans to perform more advanced queries on your data.
In the sample code, two variables are defined: my_kitchen
and your_kitchen
, representing areas.
This exercise is part of the course
Intermediate Python
Exercise instructions
- Write Python expressions, wrapped in a
print()
function, to check whether:my_kitchen
is bigger than 10 and smaller than 18.my_kitchen
is smaller than 14 or bigger than 17.- double the area of
my_kitchen
is smaller than triple the area ofyour_kitchen
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Define variables
my_kitchen = 18.0
your_kitchen = 14.0
# my_kitchen bigger than 10 and smaller than 18?
# my_kitchen smaller than 14 or bigger than 17?
# Double my_kitchen smaller than triple your_kitchen?