Calculating baker's percentages in Python