Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 866ddeb

Browse filesBrowse files
committed
First commit
1 parent db5abc8 commit 866ddeb
Copy full SHA for 866ddeb

File tree

Expand file treeCollapse file tree

3 files changed

+32
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+32
-2
lines changed
Open diff view settings
Collapse file

‎Work/bounce.py‎

Copy file name to clipboard
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
# bounce.py
22
#
33
# Exercise 1.5
4+
height = 100 # meters
5+
bounces = 0 # number of bounces
6+
7+
while bounces < 10:
8+
bounces = bounces + 1
9+
height = height * (3/5)
10+
# print(height)
11+
print(round(height, 4))
Collapse file

‎Work/mortgage.py‎

Copy file name to clipboard
+11-2Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
# mortgage.py
2-
#
3-
# Exercise 1.7
2+
3+
principal = 500000.0
4+
rate = 0.05
5+
payment = 2684.11
6+
total_paid = 0.0
7+
8+
while principal > 0:
9+
principal = principal * (1+rate/12) - payment
10+
total_paid = total_paid + payment
11+
12+
print('Total paid', total_paid)
Collapse file

‎Work/sears.py‎

Copy file name to clipboard
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
bill_thickness = 0.11 * 0.001 # Meters (0.11 mm)
2+
sears_height = 442 # Height (meters)
3+
num_bills = 1
4+
day = 1
5+
6+
while num_bills * bill_thickness < sears_height:
7+
print(day, num_bills, num_bills * bill_thickness)
8+
day = day + 1
9+
num_bills = num_bills * 2
10+
11+
print('Number of days', day)
12+
print('Number of bills', num_bills)
13+
print('Final height', num_bills * bill_thickness)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.