Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+4 votes

For example i know that if i wanted to have 3 decimal places on a number, i could do:

print(f"Total coins: {totalCoins:.3f}")

but if i had 1,000,000.000 coins, how can i get the commas separators in there too?

asked in CSC201 Spring 2021 by (1 point)

1 Answer

+3 votes

you just include the comma as well. {totalCoins:,.3f} will work.

answered by (1 point)