In this lesson, students learn about the intricacies of floating point numbers. When using comparison operators with floating point numbers in Python, we will sometimes see strange behavior because of bizarre rounding methods. When using a comparison operator with floating point numbers, you should use round(x)
to avoid strange rounding behavior. round(x, n)
will round the float x
to n
decimal places. round(x)
will round the float x
to 0 decimal places.
Students will be able to:
These are all the activities included in the lesson