# Display no. of units sold in each month
sales = {}

while True:
    month = int(input("Enter month :"))
    if month == 0:
        break

    qty = int(input("Enter quantity : "))
    if month in sales:
        sales[month] = sales[month] + qty   # Update existing entry
    else:
        sales[month] = qty      # Add new entry

for m, q in sorted(sales.items()):
    print("%3d  %5d" % (m, q))

9c075926ac66117f11307f9a649f07308f94de96
<mask token>

<mask token>
while True:
    month = int(input('Enter month :'))
    if month == 0:
        break
    qty = int(input('Enter quantity : '))
    if month in sales:
        sales[month] = sales[month] + qty
    else:
        sales[month] = qty
for m, q in sorted(sales.items()):
    print('%3d  %5d' % (m, q))

sales = {}
while True:
    month = int(input('Enter month :'))
    if month == 0:
        break
    qty = int(input('Enter quantity : '))
    if month in sales:
        sales[month] = sales[month] + qty
    else:
        sales[month] = qty
for m, q in sorted(sales.items()):
    print('%3d  %5d' % (m, q))

# Display no. of units sold in each month
sales = {}

while True:
    month = int(input("Enter month :"))
    if month == 0:
        break

    qty = int(input("Enter quantity : "))
    if month in sales:
        sales[month] = sales[month] + qty   # Update existing entry
    else:
        sales[month] = qty      # Add new entry

for m, q in sorted(sales.items()):
    print("%3d  %5d" % (m, q))
