Skip to content

int_part [terminology]

Terminology

Usage

  • Use for the integer portion of a fraction or decimal representation.
  • It is clearer than val when paired with a remainder or fractional part.
  • Do not use num, because the variable represents only one part of the number.
a, b = numerator, denominator
# ...
int_part, rem = divmod(a, b)

See 166. Fraction to Recurring Decimal.