'''  Refactor the following code
mass_oz = [0.5, 0.6, 1.2, 3.4]
mass_g = [mass * 28.3496 for mass in mass_oz]
mass_kg = [mass * 28.3496 / 1000 for mass in mass_oz]
'''

# Refactor Step 1
G_OZ = 28.3496
KG_OZ = G_OZ / 1000

mass_oz = [0.5, 0.6, 1.2, 3.4]
mass_g = [mass * G_OZ for mass in mass_oz]
mass_kg = [mass * KG_OZ for mass in mass_oz]

# Refactor Step 2
def convert_mass(mass_oz, conv_factor):
    return [m * conv_factor for m in mass_oz]

# Refactor Step 3
if __name__ == "__main__":
    mass_oz = [0.5, 0.6, 1.2, 3.4, 5.6, 7.8, 9.1]
    print("Ounces")
    print(", ".join(str(m) for m in mass_oz))
    print("Grams")
    print(", ".join(str(m) for m in convert_mass(mass_oz, G_OZ)))
    print("Kilograms")
    print(", ".join(str(m) for m in convert_mass(mass_oz, KG_OZ)))