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.
Diese Übung ist Teil des Kurses
Intermediate Python
Anleitung zur Übung
- 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.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Define variables
room = "kit"
area = 14.0
# if statement for room
if room == "kit" :
print("looking around in the kitchen.")
# if statement for area