Concept

round()

The round() function rounds off a number to N decimal points. Syntax:

round(number, digits)

number is the number to be rounded. digit is the number of decimals. If the digits parameter is empty, the default value is 0 and the number is rounded to the nearest integer.

x = round(2.8399, 2) #2.84 y = round(2.8391, 3) #2.839 z = round(2.8399) #3 print(x) print(y) print(z)

0

1

Updated 2021-03-26

Contributors are:

Who are from:

Tags

Python Programming Language

Data Science

Related