Module 4 Lesson 5 - Floating Point Numbers and Rounding
The student will consider the following...
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. The version, round(x, n), will round the float x to n decimal places. The version, round(x), will round the float x to 0 decimal places.
The student will be able to...
- Use floating point numbers
- Round values in their programs
- Using the round function
- Using the int cast to round to the nearest whole number (NOT IN CODEHS)
The student should know the following vocabulary...
- round( ) function syntax
- round(x)
- round(x, n)
- round(x, 0)
- float( ) function syntax
- int casting to round
The student will perform the following activities...
- Review the Module 2 Lesson 4 CodeHS (4.4) Exercises
- Complete the Module 2 Lesson 5 Warmup
- Complete the Code HS Unit 4 Lesson 5 (4.5) Floating Point Numbers and Rounding
- Complete the Module 2 Lesson 5 Quiz