Program on python

Good day! Tell me, please, is it possible to write a program on Python for laying out parts by mass. Input data - mass of parts. The output data of the mass of parts taking into account the imbalance.