Math (Python)

Get Quotient and Remainder

divmod returns a tuple of the quotient and the remainder/modulo.

divmod(20, 3) # (6, 2)

Round Decimals

The round function in Python allows you to round your decimal. The arguments taken are:

# round(number, decimal_places)
round(3.1415926, 3)  # 3.142

References

  1. https://tutorialdeep.com/knowhow/round-float-to-2-decimal-places-python/

Last modified: 202401040446