This is my code so far:
number = 201234
print(f'number is {number:,.0f}')
This prints: number is 201,234
However I want it to print: number is 200,000
I've tried using print(f'number is {number:,.1g}')
but this prints in scientific notation like so: number is 2e+05
Is there a simple way to format this to get the desired outcome?
Use the
round()
function with a negative argument.Prints