Pouring problem implemented in python