6 kyu
Add commas to a number
428 of 829tdowek1
Description:
Your task is to convert a given number into a string with commas added for easier readability. The number should be rounded to 3 decimal places and the commas should be added at intervals of three digits before the decimal point. There does not need to be a comma at the end of the number.
You will receive both positive and negative numbers.
Examples
commas(1) == "1"
commas(1000) == "1,000"
commas(100.2346) == "100.235"
commas(1000000000.23) == "1,000,000,000.23"
commas(-1) == "-1"
commas(-1000000.123) == "-1,000,000.123"
Regular Expressions
Fundamentals
Similar Kata:
Stats:
Created | Jan 21, 2016 |
Published | Jan 21, 2016 |
Warriors Trained | 1640 |
Total Skips | 61 |
Total Code Submissions | 7890 |
Total Times Completed | 829 |
JavaScript Completions | 428 |
Python Completions | 419 |
Total Stars | 50 |
% of votes with a positive feedback rating | 84% of 261 |
Total "Very Satisfied" Votes | 194 |
Total "Somewhat Satisfied" Votes | 49 |
Total "Not Satisfied" Votes | 18 |
Total Rank Assessments | 28 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 8 kyu |