Partition Function In Python Practice