Earn 20 XP


round()

  • Round function in python rounds off the decimal value of a number to its nearest integer. For example: round(65.66) = 66.
  • In addition, one can give an input of the specified number of decimals to which the number should be rounded. For example, round(65.66, 1) = 65.7.
  • Its syntax is:
    1 round(number, ndigits)
    • number - the number to be rounded.
    • ndigits - number of decimal places up to which the given number is rounded; defaults to 0.

round()

sum()

You can perform the addition of a collection of numbers using the sum() function in Python.

sum function