Skip to content

Instantly share code, notes, and snippets.

@ycui1
Last active January 31, 2022 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ycui1/ce9ec73e0d93a0007873965e5c32ffc3 to your computer and use it in GitHub Desktop.
Save ycui1/ce9ec73e0d93a0007873965e5c32ffc3 to your computer and use it in GitHub Desktop.
def quotient(dividend, divisor, taking_int=False):
"""
Calculate the product of two numbers with a base factor.
:param dividend: int | float, the dividend in the division
:param divisor: int | float, the divisor in the division
:param taking_int: bool, whether only taking the integer part of the quotient;
default: False, which calculates the precise quotient of the two numbers
:return: float | int, the quotient of the dividend and divisor
"""
result = dividend / divisor
if taking_int:
result = int(result)
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment