Round
round(number, digits(optional))
Rounds the float value to the given number of decimal digits.digits
-> define the number of decimal digits to be considered for rounding.when not specified default is
0
Code
PYTHON
Output
Floating Point Approximation
Float values are stored approximately.
Code
Output
Floating Point Errors
Sometimes, floating point approximation gives unexpected results.
Code
PYTHON
Output
To avoid these unexpected results, we can use
round()
Code
PYTHON
Output
Comments
Comment starts with a hash
#
It can be written in its own line next to a statement of code.
Code
PYTHON