This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_commas(number): | |
"""Add commas to a number every 3 places and return the result as a string. | |
Handles positives/negatives, cases where 0 < abs(x) < 1, and numbers | |
passed as a string.""" | |
# Ensure that the argument is a string | |
number = str(number) | |
isnegative = number[0] == "-" |