forked from AllenDowney/ThinkPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b080d8f
commit 99b5599
Showing
9 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |