Timeline for Pretty-print dollar amounts using custom precision for large amounts
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 1, 2020 at 17:00 | vote | accept | Martin Burch | ||
Jun 22, 2020 at 18:50 | answer | added | chux | timeline score: 1 | |
Jun 12, 2020 at 19:16 | answer | added | Peilonrayz♦ | timeline score: 2 | |
Jun 12, 2020 at 10:49 | comment | added | Martin Burch |
@Energya that's a good point. I could use a regular expression return re.sub(r"^1 cents$", "1 cent", f"{round(number * 100):,} cents") or perhaps some logic that checks the output string is exactly 1 cents and then returns 1 cent .
|
|
Jun 12, 2020 at 9:36 | comment | added | Energya |
I suspect the replace in your final line isn't doing what you want: e.g. convert_float_to_value(.51) returns '51 cent'
|
|
Jun 12, 2020 at 9:00 | history | tweeted | twitter.com/StackCodeReview/status/1271366675691175936 | ||
Jun 12, 2020 at 7:32 | history | edited | Martin Burch | CC BY-SA 4.0 |
update logic
|
Jun 11, 2020 at 15:51 | history | asked | Martin Burch | CC BY-SA 4.0 |