forked from AllenDowney/ThinkPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpace_calc.py
More file actions
26 lines (18 loc) · 608 Bytes
/
Copy pathpace_calc.py
File metadata and controls
26 lines (18 loc) · 608 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
"""
Code example from Think Python, by Allen B. Downey.
Available from http://thinkpython.com
Copyright 2013 Allen B. Downey.
Distributed under the GNU General Public License at gnu.org/licenses/gpl.html.
If you run a 10 kilometer race in 43 minutes 30 seconds, what is your
average time per mile? What is your average speed in miles per hour?
(Hint: there are 1.61 kilometers in a mile).
"""
minutes = 43.5
hours = minutes / 60
km_per_mile = 1.61
km = 10
miles = km / km_per_mile
pace = minutes / miles
mph = miles / hours
print 'Pace in minutes per mile:', pace
print 'Average speed in mph:', mph