if
It's time to take a closer look around in your house.
Two variables are defined in the sample code: room, a string that tells you which room of the house we're looking at, and area, the area of that room.
This exercise is part of the course
Intermediate Python for Data Science
Exercise instructions
- Examine the
ifstatement that prints out"Looking around in the kitchen."ifroomequals"kit". - Write another
ifstatement that prints out "big place!" ifareais greater than 15.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Define variables
room = "kit"
area = 14.0
# if statement for room
if room == "kit" :
print("looking around in the kitchen.")
# if statement for area