round¶
Syntax¶
Parameters¶
x- An expression that evaluates to a number.
Returns¶
Returns the nearest integer value to x, or the integer further from 0 if
x is halfway between two integers.
Description¶
This is the mathematical rounding action, returning the nearest integer to the given value. It rounds values that are halfway between two integers away from zero.
Examples¶
For some numeric variable my_variable:
my_variable = round(20.14159) # my_variable = 20
my_variable = round(19.5) # my_variable = 20
my_variable = round(-19.5) # my_variable = -20
my_variable = round(-19.4) # my_variable = -19