forked from AllenDowney/ThinkPython2
-
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
49a6f31
commit f9de5f7
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
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,33 @@ | ||
"""This module contains a code example related to | ||
Think Python, 2nd Edition | ||
by Allen Downey | ||
http://thinkpython2.com | ||
Copyright 2015 Allen Downey | ||
License: http://creativecommons.org/licenses/by/4.0/ | ||
""" | ||
|
||
|
||
|
||
""" | ||
If I leave my house at 6:52 am and run 1 mile at an easy pace | ||
(8:15 per mile), then 3 miles at tempo (7:12 per mile) and | ||
1 mile at easy pace again, what time do I get home for breakfast? | ||
""" | ||
|
||
easy_min = 8 + 15 / 60 | ||
tempo_min = 7 + 12 / 60 | ||
|
||
total_min = 2 * easy_min + 3 * tempo_min | ||
print('Total minutes:', total_min) | ||
|
||
time_hour = 6 + 52 / 60 + total_min / 60 | ||
print('Time in hours', time_hour) | ||
|
||
hours = 7 | ||
minutes = (time_hour - hours) * 60 | ||
print('Time in hours and minutes', hours, minutes) |