Skip to content

Commit 1d2cea1

Browse files
Create Washing_Machine.py
1 parent 14154fb commit 1d2cea1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# say you wanted to make a washing machine calculator that would return you the amount of water required to wash some clothes if you
2+
# knew that every extra unit required 10% more water:
3+
4+
def how_much_water(water, clothes, load):
5+
if load > 2 * clothes:
6+
return "Too much clothes"
7+
8+
if load < clothes:
9+
return "Not enough clothes"
10+
11+
for i in range(load - clothes):
12+
water *= 1.1
13+
14+
return round(water, 2)
15+
16+
def how_much_water(l, x, n):
17+
return "Too much clothes" if n > 2*x else "Not enough clothes" if n < x else round(1.1**(n-x)*l, 2)

0 commit comments

Comments
 (0)