round() is a float class method which return a float value rounded to the nearest value with n digits decimal digits precision.
Parameter: float value as argument
Return: Float value rounded to nearest precision
If precision is -ve : integer with at least ndigits.abs trailing zeros
If ndigits is +ve : a floating-point number, otherwise integer
Example #1 :
rounding a : 1 rounding b : 2999
Example #2 :
round a : 0.77 round b : 3000 round c : 2
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.