Floating-point numbers (float
s) in Python are written with a decimal point. It is considered good style
to always have at least one digit both before and after the decimal point. Write, for example, 1.0
instead of 1.
and write 0.1
instead of .1
.
The arithmetic operators for floating-point numbers are the same as those for integers, except that floating-point
division is written /
.
As in Java, floating-point numbers are limited both in size and precision, and any of these operations may result in rounding errors.
Fill in the placeholders so that the actual outputs match the expected outputs up to rounding error.