A floating-point number represents fractional values and a wide range of magnitudes, but finite precision can make its stored value inexact. Use it for ordinary measurements when small representation differences are acceptable; choose another representation for sensitive calculations. section 1.12 section 1.13
Practical Python patterns include:
- Convert user input with float, and catch ValueError when the input may be invalid. section 1.13
- Format output with an f-string when a controlled number of decimal places is more useful than the raw representation. section 1.13
- Use integers for fixed units such as cents when exact monetary values matter; explore Decimal for decimal-oriented arithmetic. section 1.13 section 1.16
Run-time average
Accumulate several 10-kilometer run times as floating-point inputs, stop when the user presses Enter, and display the average. For example, 15, 20, and 10 produce an average of 15.0 over three runs. section 1.12



















