资料内容:
Converting Units of Measurement
The International System of Units defines seven base quantities. These are
then used to derive other quantities, referred to as derived quantities. Length
(including width, height, and depth), time, mass, and temperature are four
of the seven base quantities. Each of these quantities has a standard unit of
measurement: meter, second, kilogram, and kelvin, respectively.
But each of these standard measurement units also has multiple non
standard measurement units. You are more familiar with the temperature
being reported as 30 degrees Celsius or 86 degrees Fahrenheit than as
303.15 kelvin. Does that mean 303.15 kelvin feels three times hotter than
86 degrees Fahrenheit? No way! We can’t compare 86 degrees Fahrenheit
to 303.15 kelvin only by their numerical values because they’re expressed
in different measurement units, even though they measure the same
physical quantity—temperature. You can compare two measurements
of a physical quantity only when they’re expressed in the same unit of
measurement.
Conversions between different units of measurement can be tricky,
and that’s why you’re often asked to solve problems that involve conversion
between different units of measurement in high school. It’s a good way to
test your basic mathematical skills. But Python has plenty of math skills,
too, and, unlike some high school students, it doesn’t get tired of crunch
ing numbers over and over again in a loop! Next, we’ll explore writing pro
grams to perform those unit conversions for you.
We’ll start with length. In the United States and United Kingdom,
inches and miles are often used for measuring length, while most other
countries use centimeters and kilometers.