- 2 When Large Numbers Are Written Out On Paper It Is Traditional To Use Commas To Separate The Digits Into Groups Of Th 1 (31.24 KiB) Viewed 27 times
2. When large numbers are written out on paper, it is traditional to use commas to separate the digits into groups of th
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
2. When large numbers are written out on paper, it is traditional to use commas to separate the digits into groups of th
2. When large numbers are written out on paper, it is traditional to use commas to separate the digits into groups of three. For example, the number one million is usually written in the following form: 1,000,000 To make it easier for programmers to display numbers in this fashion, implement a function def addCommasToNumericString(digits): that takes a string of decimal digits representing a number and returns the string formed by inserting commas at every third position, starting on the right. For example, if you were to execute the program while True: digits input("Enter a numeric string: ") = if len(digits) = == 0: break else: print(addCommasToNumericString(digits))