Format an Integer with Thousands Separators

Implement a function that converts an integer to a string with a comma inserted every three digits from right to left.

def format_number(n: int) -> str:
    ...

Requirements:

  • Handle...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: