About 586 letters

About 3 minutes

#round

Description: Calculate the approximate value (rounding).

def round(number, ndigits=None):
    '''
    Calculate the approximate value

    :param number: The value to be rounded
    :param ndigits: Number of decimal places to keep
    :return: The rounded value
    '''

Example:

print(round(3.1415926))
print(round(3.1415926, 2))
print(round(2.71828))
print(round(2.71828, 2))

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

Updated: 6/9/2025

Author: PlanC

Created: 6/9/2025