Python – Round a Float number to nearest integer

Python – Round a Number to Nearest Integer

To round a given number to nearest integer in Python, call round() function and pass the given number as argument.


The syntax of round() function is



1. Round Number to Nearest Integer

In this example, we take a float value with five digits after decimal point, and round the number to nearest integer.

Python Program

number = 3.14159
result = round(number)
print('Original Value :', number)
print('Rounded Value  :', result)
Run Code Copy


Original Value : 3.14159
Rounded Value  : 3


In this tutorial of Python Examples, we learned how to round a given number to specified number of decimal places.

Related Tutorials

Code copied to clipboard successfully 👍