Skip to content

Commit eb26ce2

Browse files
committed
Completed solution bounce solution.
1 parent 9c3e2e3 commit eb26ce2

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

‎Work/bounce.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
# bounce.py
22
#
33
# Exercise 1.5
4+
5+
drop_height = 100 # Height (meters)
6+
bounce = 0.6
7+
bounces = 1
8+
9+
while bounces <= 10:
10+
print(f'{bounces} {drop_height*bounce:.2f}')
11+
bounces += 1
12+
drop_height = (drop_height*bounce)

‎Work/sears.py‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# sears.py
2+
3+
def main():
4+
5+
bill_thickness = 0.11 * 0.001 # Meters (0.11 mm)
6+
sears_height = 442 # Height (meters)
7+
num_bills = 1
8+
day = 1
9+
10+
while num_bills * bill_thickness < sears_height:
11+
print(day, num_bills, num_bills * bill_thickness)
12+
day = day + 1
13+
num_bills = num_bills * 2
14+
15+
print(f'Number of days {day}')
16+
print(f'Number of bills {num_bills}')
17+
print(f'Final height {num_bills * bill_thickness}')
18+
19+
20+
if __name__ == '__main__':
21+
main()
22+
23+

0 commit comments

Comments
 (0)