-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Expand file tree
/
Copy pathadd-else.py
More file actions
29 lines (24 loc) · 716 Bytes
/
add-else.py
File metadata and controls
29 lines (24 loc) · 716 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
'''
Add else
100xp
On the right, the if construct for room has been extended with an else statement
so that "looking around elsewhere." is printed if the condition room = "kit"
evaluates to False.
Can you do a similar thing to add more functionality to the if construct for area?
Instructions
-Add an else statement to the second control structure so that "pretty small."
is printed out if area > 15 evaluates to False.
'''
# Define variables
room = "kit"
area = 14.0
# if-else construct for room
if room == "kit" :
print("looking around in the kitchen.")
else :
print("looking around elsewhere.")
# if-else construct for area
if area > 15 :
print("big place!")
else:
print("pretty small.")