-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathcustomize-further-elif.py
More file actions
33 lines (29 loc) · 911 Bytes
/
customize-further-elif.py
File metadata and controls
33 lines (29 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'''
Customize further: elif
100xp
It's also possible to have a look around in the bedroom. The sample code contains an
elif part that checks if room equals "bed". In that case, "looking around in the bedroom."
is printed out.
It's up to you now! Make a similar addition to the second control structure to further
customize the messages for different values of area.
Instructions
Add an elif to the second control structure such that "medium size, nice!" is printed out
if area is greater than 10.
'''
# Define variables
room = "bed"
area = 14.0
# if-elif-else construct for room
if room == "kit" :
print("looking around in the kitchen.")
elif room == "bed":
print("looking around in the bedroom.")
else :
print("looking around elsewhere.")
# if-elif-else construct for area
if area > 15 :
print("big place!")
elif area > 10:
print("medium size, nice!")
else :
print("pretty small.")