Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download

📚 The CoCalc Library - books, templates and other resources

Views: 96166
License: OTHER
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
from __future__ import print_function, division
13
14
15
"""
16
17
If you run a 10 kilometer race in 43 minutes 30 seconds, what is your
18
average time per mile? What is your average speed in miles per hour?
19
(Hint: there are 1.61 kilometers in a mile).
20
21
"""
22
23
minutes = 43.5
24
hours = minutes / 60
25
26
km_per_mile = 1.61
27
km = 10
28
miles = km / km_per_mile
29
30
pace = minutes / miles
31
mph = miles / hours
32
33
print('Pace in minutes per mile:', pace)
34
print('Average speed in mph:', mph)
35
36