datajudge.utils module

datajudge.utils.format_difference(n1, n2, decimal_separator=True)

Given two numbers, n1 and n2, return a tuple of two strings, each representing one of the input numbers with the differing part highlighted. Highlighting is done using BBCode-like tags, which are replaced by the formatter.

Examples:

123, 123.0 -> 123, 123[numDiff].0[/numDiff] 122593859432, 122593859432347 -> 122593859432, 122593859432[numDiff]347[/numDiff]

Args: - n1: The first number to compare. - n2: The second number to compare. - decimal_separator: Whether to separate the decimal part of the numbers with commas.

Returns: - A tuple of two strings, each representing one of the input numbers with the differing part highlighted.

Parameters:
  • n1 (Union[float, int])

  • n2 (Union[float, int])

  • decimal_separator (bool)

Return type:

Tuple[str, str]