Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f9de5f7

Browse files
committed
Adding breakfast
1 parent 49a6f31 commit f9de5f7

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

code/breakfast.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""This module contains a code example related to
2+
3+
Think Python, 2nd Edition
4+
by Allen Downey
5+
http://thinkpython2.com
6+
7+
Copyright 2015 Allen Downey
8+
9+
License: http://creativecommons.org/licenses/by/4.0/
10+
"""
11+
12+
13+
14+
"""
15+
16+
If I leave my house at 6:52 am and run 1 mile at an easy pace
17+
(8:15 per mile), then 3 miles at tempo (7:12 per mile) and
18+
1 mile at easy pace again, what time do I get home for breakfast?
19+
20+
"""
21+
22+
easy_min = 8 + 15 / 60
23+
tempo_min = 7 + 12 / 60
24+
25+
total_min = 2 * easy_min + 3 * tempo_min
26+
print('Total minutes:', total_min)
27+
28+
time_hour = 6 + 52 / 60 + total_min / 60
29+
print('Time in hours', time_hour)
30+
31+
hours = 7
32+
minutes = (time_hour - hours) * 60
33+
print('Time in hours and minutes', hours, minutes)

0 commit comments

Comments
 (0)