Python TutorialLesson 9Free preview
Python Numbers
This lesson is part of Python · All levels
Summary
Python supports several types of numbers, especially int for integers and float for decimal numbers. The partition operator always generates a float, while the // generates a round partition and the % takes the remainder for. In addition, operators ** are used for ranking so that the basic mathematical needs can be met without additional libraries.
Key points
- Int type keeps the integers and float keeps the decimal numbers.
- Divisions always produce floats, even when the result is round.
- The // operator ignores the decimal and the % produces the remainder of the distribution.
- Fractional numbers have precision limitations because they are stored in binary format.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.