Question: Consider the following numbers:

```
1000.10
1000.11
1000.113

```

I would like to get these to print out in python as:

```
1,000.10
1,000.11
1,000.11

```

The following transformations almost do this, except that whenever the second digit to the right of the decimal point is a zero, the zero is elided and as a result that number doesn't line up properly.

This is my attempt:

```
for n in [1000.10, 1000.11, 1000.112]:
    nf = '%.2f' %n   # nf is a 2 digit decimal number, but a string
    nff = float(nf)  # nff is a float which the next transformation needs 
    n_comma = f'{nff:,}' # this puts the commas in 
    print('%10s' %n_comma)

 1,000.1
1,000.11
1,000.11

```

Is there a way to avoid eliding the ending zero in the first number?

Answer: 
You want the format specifier `',.2f'`. `,`, as you noted, performs comma separation of thousands, while `.2f` specifies that two digits are to be retained:

```
print([f'{number:,.2f}' for number in n])

```

Output:

```
['1,000.10', '1,000.11', '1,000.11']

```
You might be able to do it like this:

```
num = 100.0
print(str(num) + "0")

```

So you print the number as a string plus 0 at the end.
Update: 
So that it doesn’t do this to all numbers, try doing something like:

```
if num == 1000.10:
#add the zero
elif num == 1000.20:
#again, add the zero
#and so on and so on...

```

So if the number has a zero at the end (its decimal values are .10, .20, .30, etc.), add one, and if not, don’t.