Skip to content

Commit

Permalink
Adding breakfast
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenDowney committed May 14, 2021
1 parent 49a6f31 commit f9de5f7
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions code/breakfast.py
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)

0 comments on commit f9de5f7

Please sign in to comment.